summaryrefslogtreecommitdiff
path: root/components/Sidebar/Note.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-10-08 23:39:37 +0200
committerThomas F. K. Jorna <[email protected]>2021-10-08 23:39:37 +0200
commit2384b30a244c7d6477e54de5385fe7f1cc62d43a (patch)
tree55c9f82f9475249a7f91ac44e408e04e9f1c9560 /components/Sidebar/Note.tsx
parentfd4edbd6a854275c10c5b21173f0875921d547d1 (diff)
feat(preview): proper file preview with api routing
Diffstat (limited to 'components/Sidebar/Note.tsx')
-rw-r--r--components/Sidebar/Note.tsx69
1 files changed, 69 insertions, 0 deletions
diff --git a/components/Sidebar/Note.tsx b/components/Sidebar/Note.tsx
new file mode 100644
index 0000000..ef2e2b2
--- /dev/null
+++ b/components/Sidebar/Note.tsx
@@ -0,0 +1,69 @@
+import React from 'react'
+import { NodeObject } from 'force-graph'
+
+import { NodeById, NodeByCite, LinksByNodeId } from '../../pages'
+import { Box, Flex } from '@chakra-ui/react'
+import { UniOrg } from '../../util/uniorg'
+import { Backlinks } from '../../components/Sidebar/Backlinks'
+import { noteStyle } from './noteStyle'
+
+export interface NoteProps {
+ setPreviewNode: any
+ previewNode: NodeObject
+ nodeById: NodeById
+ nodeByCite: NodeByCite
+ setSidebarHighlightedNode: any
+ justification: number
+ justificationList: string[]
+ linksByNodeId: LinksByNodeId
+}
+
+export const Note = (props: NoteProps) => {
+ const {
+ setPreviewNode,
+ justificationList,
+ justification,
+ previewNode,
+ nodeById,
+ nodeByCite,
+ setSidebarHighlightedNode,
+ linksByNodeId,
+ } = props
+ return (
+ <Box
+ pr={8}
+ overflow="scroll"
+ height="85%"
+ className="org"
+ sx={{
+ ...noteStyle,
+
+ textAlign: justificationList[justification],
+ }}
+ >
+ {previewNode?.id && (
+ <Flex height="100%" flexDirection="column" justifyContent="space-between">
+ <UniOrg
+ {...{
+ setPreviewNode,
+ previewNode,
+ nodeById,
+ nodeByCite,
+ setSidebarHighlightedNode,
+ }}
+ />
+ <Backlinks
+ {...{
+ setPreviewNode,
+ previewNode,
+ nodeById,
+ linksByNodeId,
+ nodeByCite,
+ setSidebarHighlightedNode,
+ }}
+ />
+ </Flex>
+ )}
+ </Box>
+ )
+}