/* Copyright 2021, vite-plugin-book by Mirone. */ import { FC } from 'react'; import { useLocation } from 'react-router-dom'; import { useOutline } from '../../hook/useOutline'; import cx from './Outline.module.css'; type OutlineItem = { text: string; active?: boolean; level: number; }; export type OutlineList = OutlineItem[]; const NestedDiv: FC<{ level: number }> = ({ level, children }) => { if (level === 0) { return <>{children}; } return (
{children}
); }; export const Outline: FC = () => { const location = useLocation(); const [data] = useOutline(); return (
{data.map((item) => { const url = '#' + item.text.toLowerCase().split(' ').join('-'); return (
{item.text}
); })}
); };