Skip to content

Commit a5f41d2

Browse files
committed
isLoading及びerrorにおける処理変更
1 parent d2abe89 commit a5f41d2

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

app/sidebar.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ export function Sidebar() {
1414
fetcher
1515
)
1616

17-
if (isLoading) return <div>Loading...</div>
18-
if (error) return <div>Error: {error.message}</div>
19-
2017
const pages = [
2118
{ id: "python-1", title: "1. 環境構築と基本思想" },
2219
{ id: "python-2", title: "2. 基本構文とデータ型" },
@@ -29,6 +26,25 @@ export function Sidebar() {
2926
{ id: "python-9", title: "9. ジェネレータとデコレータ" },
3027
];
3128

29+
if (isLoading) return (
30+
<div className="bg-base-200 min-h-full w-80 p-4">
31+
<h2 className="hidden text-xl font-bold mb-4">
32+
{/* サイドバーが常時表示されている場合のみ */}
33+
Navbar Title
34+
</h2>
35+
<ol className="menu w-full list-outside">
36+
{pages.map((page) =>
37+
<li key={page.id}>
38+
<Link href={`/${page.id}`}>{page.title}</Link>
39+
</li>
40+
)}
41+
</ol>
42+
</div>
43+
)
44+
if (error) return console.error()
45+
46+
47+
3248
const splitmdcontent = splitMarkdown(data ?? "")
3349
return (
3450
<div className="bg-base-200 min-h-full w-80 p-4">

0 commit comments

Comments
 (0)