Skip to content

Instantly share code, notes, and snippets.

@andyhite
Created October 4, 2019 19:22
Show Gist options
  • Save andyhite/4167b227ff2f8630d73e25712fe568fd to your computer and use it in GitHub Desktop.
Save andyhite/4167b227ff2f8630d73e25712fe568fd to your computer and use it in GitHub Desktop.
const DOCUMENT_FORMS = {
"pay_application": PayApplicationForm,
"invoice": InvoiceForm,
...
}
const DocumentViewer = (props) => {
const { document } = props;
const DocumentForm = DOCUMENT_FORMS[document.type];
const fileViewHeader = (
<Pane padding={16} display="flex" justifyContent="space-between">
<Pane>
<Text size={600}>Boulding Creek Draw 7 Uploads</Text>
</Pane>
<Pane>
<Button>Next</Button>
...
</Pane>
</Pane>
);
const fileViewSidebar = (
...
);
return (
<FileViewer
header={fileViewHeader}
sidebar={fileViewSidebar}
previewFileUrl={document.file.url}
previewFileType={document.file.type}
>
<DocumentForm {...props} />
</FileViewer>
)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment