Skip to content

Commit 552bd70

Browse files
committed
サイドバーのスクロール動作を修正
1 parent f8c7386 commit 552bd70

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

app/sidebar.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export function Sidebar({ pagesList }: { pagesList: LanguageEntry[] }) {
118118
}, [currentLangIndex]);
119119

120120
return (
121-
<div className="bg-base-200 h-full w-80 overflow-y-auto">
121+
<div className="bg-base-200 h-full w-80 flex flex-col">
122122
<h2 className="hidden lg:flex flex-row items-center p-4 gap-2">
123123
{/* サイドバーが常時表示されているlg以上の場合のみ */}
124124
<Link href="/" className="flex-1 flex items-center">
@@ -136,7 +136,7 @@ export function Sidebar({ pagesList }: { pagesList: LanguageEntry[] }) {
136136
<label
137137
htmlFor="drawer-toggle"
138138
aria-label="open sidebar"
139-
className="btn btn-ghost"
139+
className="btn btn-ghost w-full justify-start"
140140
>
141141
<svg
142142
className="w-8 h-8"
@@ -156,7 +156,16 @@ export function Sidebar({ pagesList }: { pagesList: LanguageEntry[] }) {
156156
</label>
157157
</span>
158158

159-
<ul className="menu w-full">
159+
<ul
160+
className="menu w-full h-max flex-nowrap grow-1 overflow-y-auto overflow-x-clip"
161+
style={{
162+
scrollbarGutter: "stable",
163+
// DaisyUIはスクロールバーカラーを変更しているが、sidebarを開いた際にはさらに暗い色に変更してしまう
164+
// ここではsidebarの状態によらずDaisyUIがデフォルトで設定しているスクロールバーカラーを復元
165+
scrollbarColor:
166+
"color-mix(in oklch, currentColor 35%, transparent) transparent",
167+
}}
168+
>
160169
{pagesList.map((group, i) => (
161170
<li key={group.id}>
162171
<details

0 commit comments

Comments
 (0)