import type { ReactNode } from 'react'; import { IconButton, Box, CloseButton, Flex, HStack, Icon, Image, useColorModeValue, Link, Drawer, DrawerContent, useDisclosure, type BoxProps, type FlexProps, Heading, Stack, Text, Popover, PopoverTrigger, PopoverContent, } from '@chakra-ui/react'; import { FiChevronRight, FiMenu } from 'react-icons/fi'; import type { IconType } from 'react-icons'; import Browser from 'webextension-polyfill'; export interface SideBarItem { label: string; icon: IconType; href: string; } export interface HeadBarItem { label: string; subLabel?: string; children?: Array; href?: string; } export default function SidebarWithHeader({ children, title, headBarItems, sideBarItems, }: { title?: string; sideBarItems: SideBarItem[]; headBarItems: SideBarItem[]; children: ReactNode; }) { const { isOpen, onOpen, onClose } = useDisclosure(); return ( onClose} display={{ base: 'none', md: 'block' }} title={title} /> {children} ); } interface SidebarProps extends BoxProps { onClose: () => void; title?: string; sideBarItems: SideBarItem[]; } const SidebarContent = ({ onClose, sideBarItems, title, ...rest }: SidebarProps) => { return ( RRWeb Logo {title && ( {title} )} {sideBarItems.map((link) => ( {link.label} ))} ); }; interface NavItemProps extends FlexProps { icon: IconType; href: string; children: string; } const NavItem = ({ icon, href, children, ...rest }: NavItemProps) => { return ( <> {icon && } {children} ); }; interface MobileProps extends FlexProps { onOpen: () => void; } const MobileNav = ({ onOpen, ...rest }: MobileProps) => { return ( } /> {rest.children && rest.children} ); }; const DesktopNav = ({ headBarItems }: { headBarItems: HeadBarItem[] }) => { const linkColor = useColorModeValue('gray.600', 'gray.200'); const linkHoverColor = useColorModeValue('gray.800', 'white'); const popoverContentBgColor = useColorModeValue('white', 'gray.800'); return ( {headBarItems.map((navItem) => ( {navItem.label} {navItem.children && ( {navItem.children.map((child) => ( ))} )} ))} ); }; const DesktopSubNav = ({ label, href, subLabel }: HeadBarItem) => { return ( {label} {subLabel} ); };