All files / src/components/documentEditor DocumentDisplay.tsx

16.66% Statements 1/6
0% Branches 0/2
0% Functions 0/3
16.66% Lines 1/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44                  66x                                                                    
import React, { ReactElement, useState } from "react";
import { Drawer, FormInstance } from "antd";
import { ContainerOutlined } from "@ant-design/icons";
import { DetailPanelProps, SaveRecordProps } from "@props/RecordProps";
import './app.css';
import DocumentDetail from "./DocumentDetail";
import { getLabelToDisplay, stopPropagationAndPreventDefault } from "@utils/ObjectUtils";
import { CloseIcon } from "../icons";
 
const DocumentDisplay = (props: DetailPanelProps): ReactElement => {
  const { zIndex, column, record} = props;
  const [drawerVisible, setDrawerVisible] = useState<boolean>(false);
  return (<>
    <ContainerOutlined
      onClick={() => setDrawerVisible(true)}
    />
    <div onClick={stopPropagationAndPreventDefault}>
      <Drawer
        rootClassName="document-display-container"
        width="910px"
        rootStyle={{ margin: "auto" }}
        destroyOnClose={true}
        zIndex={zIndex + 2}
        title={getLabelToDisplay(record ?? {} as SaveRecordProps, undefined)}
        open={drawerVisible}
        onClose={() => setDrawerVisible(false)}
        closeIcon={<CloseIcon onClick={setDrawerVisible} />}
      >
        <DocumentDetail
          column={column}
          form={{} as FormInstance}
          isCurrentActiveTab={true}
          ownerClass={""}
          record={record}
          zIndex={zIndex + 1}
          readonly={true}
        />
      </Drawer>
    </div>
  </>);
};
 
export default DocumentDisplay;