11"use client" ;
22import Link from "next/link" ;
33import { usePathname } from "next/navigation" ;
4- import useSWR from 'swr'
4+ import useSWR , { Fetcher } from 'swr'
55import { splitMarkdown } from "./[docs_id]/splitMarkdown" ;
66
7-
7+ const fetcher : Fetcher < string , string > = ( url ) => fetch ( url ) . then ( ( r ) => r . text ( ) )
88
99export function Sidebar ( ) {
10- const fetcher = ( url : string | URL | Request < unknown , CfProperties < unknown > > ) => fetch ( url ) . then ( ( r ) => r . text ( ) )
1110 const pathname = usePathname ( ) ;
1211 const docs_id = pathname . replace ( / ^ \/ / , "" ) ;
1312 const { data, error, isLoading } = useSWR (
@@ -30,7 +29,6 @@ export function Sidebar() {
3029 { id : "python-9" , title : "9. ジェネレータとデコレータ" } ,
3130 ] ;
3231
33-
3432 const splitmdcontent = splitMarkdown ( data ?? "" )
3533 return (
3634 < div className = "bg-base-200 min-h-full w-80 p-4" >
@@ -40,12 +38,12 @@ export function Sidebar() {
4038 Navbar Title
4139 </ h2 >
4240
43- < ol className = "menu w-full list-decimal list- outside" >
41+ < ol className = "menu w-full list-outside" >
4442 { pages . map ( ( page ) => (
4543 < li key = { page . id } >
4644 < Link href = { `/${ page . id } ` } > { page . title } </ Link >
4745 { page . id === docs_id && (
48- < ul className = "ml-4 mt-2 list-disc text-sm" >
46+ < ul className = "ml-4 mt-2 text-sm" >
4947 { splitmdcontent
5048 . filter ( section => section . level !== 1 )
5149 . map ( ( section , idx ) => (
0 commit comments