From 56eeb1fc6b03c4e8ed9405e301c7edc7be5fd5d9 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Fri, 1 Oct 2021 19:11:08 +0200 Subject: feat: basic preview feature --- components/Sidebar/index.tsx | 273 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 components/Sidebar/index.tsx (limited to 'components/Sidebar/index.tsx') diff --git a/components/Sidebar/index.tsx b/components/Sidebar/index.tsx new file mode 100644 index 0000000..64436f2 --- /dev/null +++ b/components/Sidebar/index.tsx @@ -0,0 +1,273 @@ +import React, { useContext, useEffect, useState } from 'react' + +import { UniOrg } from "../../util/uniorg" +import { getOrgText } from "../../util/webSocketFunctions" + +import { + Button, + Slide, + VStack, + Flex, + Heading, + Box, + CloseButton, + Text, + Drawer, + DrawerOverlay, + DrawerHeader, + DrawerBody, + DrawerCloseButton, + DrawerContent, + DrawerFooter, + IconButton, +} from '@chakra-ui/react' +import { Scrollbars } from 'react-custom-scrollbars-2' +import { ChevronLeftIcon, ChevronRightIcon } from '@chakra-ui/icons' + +import { GraphData, NodeObject, LinkObject } from 'force-graph' +import { OrgRoamNode } from '../../api' +import {ThemeContext} from '../../util/themecontext' + +export interface SidebarProps { + isOpen: boolean + onClose: any + openNode: string + nodeById: any + previewNode: NodeObject, + orgText: string +} + +const Sidebar = (props: SidebarProps) => { + + const { isOpen, onClose, openNode, nodeById, previewNode, orgText } = props + + const {highlightColor}= useContext(ThemeContext) + + useEffect(() => { + (async () => { + if (!openNode) { + return + } + if (openNode === 'nil') { + return + } + })() + + const previewRoamNode = previewNode as OrgRoamNode + }, [previewNode]) + + //maybe want to close it when clicking outside, but not sure + //const outsideClickRef = useRef(); + return ( + + + } + colorScheme="white" + aria-label="Close file-viewer" + height={100} + variant="ghost" + marginRight={-2} + bg="alt.100" + onClick={onClose} + marginTop={20} + /> + + + {previewNode.title} + + ( + + )} + > + + + + + + + + + + ) +} + +export default Sidebar + + + + +/* + {previewNode.title} + */ -- cgit v1.2.3