import React from 'react'; import { css, cx, KeylineCard, spacing } from '@mongodb-js/compass-components'; import type { JSONEditorProps } from './json-editor'; import JSONEditor from './json-editor'; import type Document from 'hadron-document'; const listStyles = css({ listStyle: 'none', position: 'relative', width: '100%', }); const listItemStyles = css({ position: 'relative', marginBottom: spacing[2], '&:last-child': { marginBottom: 0, borderBottom: '0px solid transparent', }, }); export type DocumentJsonViewProps = { docs: Document[]; isEditable: boolean; className?: string; } & Pick< JSONEditorProps, | 'isTimeSeries' | 'copyToClipboard' | 'removeDocument' | 'replaceDocument' | 'updateDocument' | 'openInsertDocumentDialog' | 'isExpanded' | 'fields' >; const keylineCardCSS = css({ overflow: 'hidden', }); /** * Represents the list view of the documents tab. */ class DocumentJsonView extends React.Component { /** * Get the document list item components. * * @param {Array} docs - The raw documents. * * @return {Array} The document list item components. */ renderDocuments() { return this.props.docs.map((doc, i) => { return (
  • ); }); } /** * Render the document list view. * * @returns {React.Component} The component. */ render() { return (
      {this.renderDocuments()}
    ); } } export default DocumentJsonView;