Skip to content

Commit b14394b

Browse files
committed
refactor(ui): extract ScrollArea styles and unify scrollports
Move scrollbar styling into a dedicated partial and align ScrollArea usage with flex min-h-0 patterns so nested panels scroll instead of collapsing or clipping content. Made-with: Cursor
1 parent db381d1 commit b14394b

17 files changed

Lines changed: 236 additions & 259 deletions

File tree

packages/webapp/src/components/bookmarkPanel/desktop/BookmarkPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const BookmarkPanel = ({ onClose }: BookmarkPanelProps) => {
2222
const { bookmarks, isLoading, isLoadingMore, hasMore, sentinelRef } = useInfiniteBookmarks()
2323

2424
return (
25-
<div className="bg-base-100 flex w-full flex-col">
25+
<div className="bg-base-100 flex min-h-0 w-full flex-col overflow-hidden">
2626
{/* Header */}
2727
<div className="border-base-300 border-b px-4 py-3">
2828
<BookmarkHeader onClose={onClose} />

packages/webapp/src/components/notificationPanel/desktop/NotificationPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const NotificationPanel = ({ onClose }: NotificationPanelProps) => {
2424
useInfiniteNotifications()
2525

2626
return (
27-
<div className="bg-base-100 flex w-full flex-col">
27+
<div className="bg-base-100 flex min-h-0 w-full flex-col overflow-hidden">
2828
{/* Header */}
2929
<div className="border-base-300 border-b px-4 py-3">
3030
<NotificationHeader onClose={onClose} />

packages/webapp/src/components/pages/design-system-docs/DesignSystemDocsPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { DesignSystemDocsProvider } from './context/DesignSystemDocsContext'
3232
*/
3333
const MainContent = () => {
3434
return (
35-
<ScrollArea className="flex-1" scrollbarSize="thin">
35+
<ScrollArea className="min-h-0 flex-1" scrollbarSize="thin">
3636
<div className="mx-auto max-w-4xl px-4 py-8 sm:px-6 lg:px-8">
3737
{/* Getting Started */}
3838
<GettingStartedSection />
@@ -110,7 +110,7 @@ const PageContent = () => {
110110
<Sidebar />
111111

112112
{/* Main area */}
113-
<div className="flex flex-1 flex-col overflow-hidden">
113+
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
114114
{/* Mobile header */}
115115
<Header />
116116

packages/webapp/src/components/pages/design-system-docs/components/navigation/Sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const Sidebar = () => {
7070

7171
{/* Sidebar */}
7272
<aside
73-
className={`fixed inset-y-0 left-0 z-50 flex w-72 flex-col border-r border-slate-200 bg-white transition-transform duration-300 lg:static lg:translate-x-0 ${
73+
className={`fixed inset-y-0 left-0 z-50 flex min-h-0 w-72 flex-col border-r border-slate-200 bg-white transition-transform duration-300 lg:static lg:translate-x-0 ${
7474
sidebarOpen ? 'translate-x-0' : '-translate-x-full'
7575
}`}>
7676
{/* Header */}
@@ -123,7 +123,7 @@ export const Sidebar = () => {
123123
</div>
124124

125125
{/* Navigation */}
126-
<ScrollArea className="flex-1" scrollbarSize="thin">
126+
<ScrollArea className="min-h-0 flex-1" scrollbarSize="thin">
127127
<nav className="p-4 pt-0">
128128
{NAV_SECTIONS.map((section) => (
129129
<div key={section.id} className="mb-4">

packages/webapp/src/components/pages/design-system-docs/components/sections/PatternsSection.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ export const PatternsSection = () => {
4343
title="Sidebar + Content Panel"
4444
code={`<div className="flex h-[100dvh] flex-col md:flex-row md:overflow-hidden">
4545
{/* Sidebar */}
46-
<aside className="w-full shrink-0 border-slate-200 md:w-72 md:border-r lg:w-80">
47-
<ScrollArea className="flex-1 p-4">
46+
<aside className="flex min-h-0 w-full shrink-0 flex-col border-slate-200 md:w-72 md:border-r lg:w-80">
47+
<ScrollArea className="min-h-0 flex-1 p-4" scrollbarSize="thin">
4848
{/* Navigation */}
4949
</ScrollArea>
5050
</aside>
5151
5252
{/* Content */}
53-
<main className="min-h-0 flex-1">
54-
<ScrollArea className="h-full p-4 sm:p-6">
53+
<main className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden">
54+
<ScrollArea className="min-h-0 flex-1 p-4 sm:p-6" scrollbarSize="thin">
5555
{/* Content */}
5656
</ScrollArea>
5757
</main>

packages/webapp/src/components/pages/document/components/DesktopEditor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ const DesktopEditor = () => {
170170
orientation="vertical"
171171
onMouseDown={handleMouseDown}
172172
isResizing={isResizing}
173+
className="z-[40]"
173174
/>
174175
<TOC />
175176
</div>

packages/webapp/src/components/pages/history/desktop/EditorContent.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import DocumentSimpleLoader from '@components/skeleton/DocumentSimpleLoader'
22
import DocumentWithPictureLoader from '@components/skeleton/DocumentWithPictureLoader'
3+
import { ScrollArea } from '@components/ui/ScrollArea'
34
import { useStore } from '@stores'
45
import { EditorContent as TiptapEditorContent } from '@tiptap/react'
56
import React from 'react'
@@ -10,23 +11,27 @@ const EditorContent = () => {
1011

1112
if (loadingHistory || !editor) {
1213
return (
13-
<div className="editorWrapper scrollbar-custom scrollbar-thin bg-base-200 flex h-full grow items-start justify-center overflow-y-auto scroll-smooth border-t-0 px-3 py-4 sm:px-6 sm:py-6">
14+
<ScrollArea
15+
className="editorWrapper bg-base-200 flex min-h-0 min-w-0 flex-1 items-start justify-center border-t-0 px-3 py-4 sm:px-6 sm:py-6"
16+
scrollbarSize="thin">
1417
<div className="ProseMirror tiptap__editor">
1518
<DocumentSimpleLoader className="heading !h-auto" level="1" />
1619
<DocumentWithPictureLoader className="heading !h-auto" level="1" />
1720
<DocumentSimpleLoader className="heading !h-auto" level="1" />
1821
</div>
19-
</div>
22+
</ScrollArea>
2023
)
2124
}
2225

2326
return (
24-
<div className="editorWrapper scrollbar-custom scrollbar-thin bg-base-200 flex h-full grow items-start justify-center overflow-y-auto scroll-smooth border-t-0 px-3 py-4 sm:px-6 sm:py-6">
27+
<ScrollArea
28+
className="editorWrapper bg-base-200 flex min-h-0 min-w-0 flex-1 items-start justify-center border-t-0 px-3 py-4 sm:px-6 sm:py-6"
29+
scrollbarSize="thin">
2530
<TiptapEditorContent
2631
editor={editor}
2732
className="tiptap__editor docy_editor mb-12 border-t-0 px-6 pt-8 sm:mb-0 sm:p-8"
2833
/>
29-
</div>
34+
</ScrollArea>
3035
)
3136
}
3237

packages/webapp/src/components/pages/history/mobile/EditorContent.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
import DocumentSimpleLoader from '@components/skeleton/DocumentSimpleLoader'
22
import DocumentWithPictureLoader from '@components/skeleton/DocumentWithPictureLoader'
3+
import { ScrollArea } from '@components/ui/ScrollArea'
34
import { useStore } from '@stores'
45
import { EditorContent as TiptapEditorContent } from '@tiptap/react'
56

7+
const scrollRootClass =
8+
'editor editorWrapper history-mobile-editor flex h-full min-h-0 w-full min-w-0 flex-1 border-t-0'
9+
610
const EditorContent = () => {
711
const loadingHistory = useStore((state) => state.loadingHistory)
812
const editor = useStore((state) => state.editor)
913

1014
if (loadingHistory || !editor) {
1115
return (
12-
<div className="editorWrapper scrollbar-custom scrollbar-thin flex h-full min-h-0 w-full flex-1 items-start justify-center overflow-y-auto scroll-smooth border-t-0">
13-
<div className={'ProseMirror tiptap__editor w-full'}>
16+
<ScrollArea className={scrollRootClass} scrollbarSize="thin">
17+
<div className="ProseMirror tiptap__editor docy_editor relative w-full">
1418
<DocumentSimpleLoader className="heading !h-auto" level="1" />
1519
<DocumentWithPictureLoader className="heading !h-auto" level="1" />
1620
<DocumentSimpleLoader className="heading !h-auto" level="1" />
1721
</div>
18-
</div>
22+
</ScrollArea>
1923
)
2024
}
2125

2226
return (
23-
<div className="editor relative flex size-full min-h-0 w-full max-w-full flex-col justify-around align-top">
24-
<div className="editorWrapper scrollbar-custom scrollbar-thin flex min-h-0 flex-1 items-start justify-center overflow-y-auto scroll-smooth border-t-0 p-0">
25-
<TiptapEditorContent editor={editor} className="tiptap__editor relative" />
26-
</div>
27-
</div>
27+
<ScrollArea className={scrollRootClass} scrollbarSize="thin">
28+
<TiptapEditorContent editor={editor} className="tiptap__editor docy_editor relative w-full" />
29+
</ScrollArea>
2830
)
2931
}
3032

packages/webapp/src/components/settings/SettingsPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const SettingsPanel = ({ defaultTab = 'profile', onClose }: SettingsPanelProps)
229229
</div>
230230

231231
{/* Scrollable content area */}
232-
<ScrollArea className="flex-1 p-4 sm:p-6" scrollbarSize="thin">
232+
<ScrollArea className="min-h-0 flex-1 p-4 sm:p-6" scrollbarSize="thin">
233233
{/* User info header */}
234234
<div className="bg-base-200 rounded-box mb-4 flex items-center gap-2.5 p-2.5">
235235
<Avatar
@@ -360,7 +360,7 @@ const SettingsPanel = ({ defaultTab = 'profile', onClose }: SettingsPanelProps)
360360
</div>
361361

362362
{/* Scrollable content */}
363-
<ScrollArea orientation="vertical" className="bg-base-200 flex-1">
363+
<ScrollArea className="bg-base-200 min-h-0 flex-1" scrollbarSize="thin">
364364
<div className="mx-auto max-w-2xl p-4 sm:p-6">{renderContent()}</div>
365365
</ScrollArea>
366366
</div>

packages/webapp/src/components/skeleton/SidebarLoader.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import { ScrollArea } from '@components/ui/ScrollArea'
22

33
const SidebarLoader = () => {
44
return (
5-
<div className="bg-base-100 border-base-300 flex h-full w-64 flex-col border-l">
5+
<div className="bg-base-100 border-base-300 flex h-full min-h-0 w-64 flex-col overflow-hidden border-l">
66
{/* Header */}
77
<div className="border-base-300 border-b p-4">
88
<div className="skeleton h-5 w-36 rounded" />
99
<div className="skeleton mt-2 h-3 w-24 rounded" />
1010
</div>
1111

1212
{/* Version list */}
13-
<ScrollArea className="flex-1" orientation="vertical" scrollbarSize="thin" hideScrollbar>
13+
<ScrollArea className="min-h-0 flex-1" scrollbarSize="thin" hideScrollbar>
1414
{[1, 2, 3].map((day) => (
1515
<div key={day} className="border-base-200 border-b">
1616
{/* Day header */}

0 commit comments

Comments
 (0)