import { Link, useLocation, useNavData } from 'dumi'; import React, { type FC } from 'react'; import { Button, chakra, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerOverlay, Hide, HStack, Show, useColorModeValue } from '@chakra-ui/react'; import { isOutLink } from '../../factory/tools'; export type NavBarConfig = { isOpen: boolean; onClose: () => void; }; export const ChakraLink = chakra(Link) as typeof Link; const Nav = () => { const { pathname } = useLocation(); const nav = useNavData(); const activeLinkColor = useColorModeValue('brand.500', 'brand.300'); return ( {nav.map(({ link, title }) => { // TODO: activePath may use root locale, active error const outLink = isOutLink(link); const actionButton = ( ); if (outLink) { return ( {actionButton} ); } return ( {actionButton} ); })} ); }; const NavBar: FC = ({ isOpen, onClose }) => { return ( <>