import type { Content } from '#api/content/$' import type { React } from '#dep/react/index' import { Texts } from '#template/components/Texts/index' import { Box, Flex } from '@radix-ui/themes' import { useLocation } from 'react-router' import { getPathActiveReport, Link } from '../Link.js' export const Items: React.FC<{ items: Content.Item[] }> = ({ items }) => { return ( {items.map((item, index) => ( ))} ) } // // // // // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • SidebarItem // // export const Item: React.FC<{ item: Content.Item }> = ({ item }) => { if (item.type === `ItemLink`) { return } if (item.type === `ItemSection` && item.isLinkToo) { return } return
} // // // // // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • SidebarItemLink // // const SBLink: React.FC<{ link: Content.ItemLink | Content.ItemSection }> = ({ link }) => { const location = useLocation() const currentPathExp = location.pathname const active = getPathActiveReport(link.pathExp, currentPathExp) return ( {link.title} ) } // // // // // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Section // // const Section: React.FC<{ section: Content.ItemSection }> = ({ section }) => { return ( {section.title} ) } // // // // // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • LinkedSection // // const LinkedSection: React.FC<{ section: Content.ItemSection }> = ({ section }) => { return ( { {section.links.map((link, index) => ( ))} } ) } const SectionLink: React.FC<{ link: Content.ItemLink }> = ({ link }) => { const location = useLocation() const active = getPathActiveReport(link.pathExp, location.pathname) return ( {link.title} ) }