@@ -3,6 +3,7 @@ import Link from "next/link";
33import { usePathname } from "next/navigation" ;
44import useSWR , { Fetcher } from "swr" ;
55import { splitMarkdown } from "./[docs_id]/splitMarkdown" ;
6+ import { pagesList } from "./pagesList" ;
67
78const fetcher : Fetcher < string , string > = ( url ) =>
89 fetch ( url ) . then ( ( r ) => r . text ( ) ) ;
@@ -12,35 +13,6 @@ export function Sidebar() {
1213 const docs_id = pathname . replace ( / ^ \/ / , "" ) ;
1314 const { data, error, isLoading } = useSWR ( `/docs/${ docs_id } .md` , fetcher ) ;
1415
15- const pages = [
16- {
17- id : "python" ,
18- lang : "Python" ,
19- pages : [
20- { id : 1 , title : "環境構築と基本思想" } ,
21- { id : 2 , title : "基本構文とデータ型" } ,
22- { id : 3 , title : "リスト、タプル、辞書、セット" } ,
23- { id : 4 , title : "制御構文と関数" } ,
24- { id : 5 , title : "モジュールとパッケージ" } ,
25- { id : 6 , title : "オブジェクト指向プログラミング" } ,
26- {
27- id : 7 ,
28- title : "ファイルの入出力とコンテキストマネージャ" ,
29- } ,
30- { id : 8 , title : "例外処理" } ,
31- { id : 9 , title : "ジェネレータとデコレータ" } ,
32- ] ,
33- } ,
34- {
35- id : "cpp" ,
36- lang : "C++" ,
37- pages : [
38- { id : 2 , title : "型システムとメモリ" } ,
39- { id : 3 , title : "関数と参照" } ,
40- ] ,
41- } ,
42- ] ;
43-
4416 if ( error ) console . error ( "Sidebar fetch error:" , error ) ;
4517
4618 const splitmdcontent = splitMarkdown ( data ?? "" ) ;
@@ -53,7 +25,7 @@ export function Sidebar() {
5325 </ h2 >
5426
5527 < ul className = "menu w-full" >
56- { pages . map ( ( group ) => (
28+ { pagesList . map ( ( group ) => (
5729 < li key = { group . id } >
5830 < details open = { docs_id . startsWith ( `${ group . id } -` ) } >
5931 < summary > { group . lang } </ summary >
0 commit comments