Skip to content

Commit cfbec51

Browse files
committed
Improve layout responsiveness and printing output
1 parent e25fedc commit cfbec51

File tree

7 files changed

+14
-18
lines changed

7 files changed

+14
-18
lines changed

frontend/src/App.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function App() {
8989
)
9090
} else {
9191
return (
92-
<div className="bg-base-100 flex h-screen w-screen flex-col">
92+
<div className="bg-base-100 flex h-screen w-screen flex-col print:h-auto">
9393
<Header />
9494
<SidebarHolder>
9595
<Routes />
@@ -140,9 +140,10 @@ function SidebarHolder({ children }: { children: React.ReactNode }) {
140140
/>
141141
<div
142142
className={
143-
isMobile
143+
'print:hidden ' +
144+
(isMobile
144145
? `drawer-side z-30 ${showDrawer ? 'drawer-open' : ''}`
145-
: 'border-base-300 transition-width flex w-64 shrink-0 flex-col overflow-hidden border-r duration-300 ease-out'
146+
: 'border-base-300 transition-width flex w-64 shrink-0 flex-col overflow-hidden border-r duration-300 ease-out')
146147
}
147148
style={{ width: showDrawer ? undefined : 0 }}
148149
>
@@ -151,12 +152,7 @@ function SidebarHolder({ children }: { children: React.ReactNode }) {
151152
<Sidebar />
152153
</div>
153154
</div>
154-
<div
155-
className="drawer-content flex grow flex-col overflow-auto p-2"
156-
style={{ scrollbarGutter: 'stable' }}
157-
>
158-
{children}
159-
</div>
155+
<div className="drawer-content flex grow flex-col">{children}</div>
160156
</div>
161157
)
162158
}

frontend/src/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function Header() {
1313
const config = useConfig((state) => state.config)
1414

1515
return (
16-
<header className="navbar bg-base-300 z-20 flex min-h-12 w-screen max-w-screen items-center p-1 shadow-lg">
16+
<header className="navbar bg-base-300 z-20 flex min-h-12 w-screen max-w-screen items-center p-1 shadow-md print:hidden">
1717
<button
1818
className="btn btn-ghost btn-square me-2"
1919
title="Toggle drawer"

frontend/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if (configJSON) {
1616
}
1717
}
1818

19-
createRoot(document.getElementById('root')!).render(
19+
createRoot(document.body).render(
2020
<StrictMode>
2121
<Router>
2222
<App />

frontend/src/pages/DocPage.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ export default function DocPage() {
173173
<>
174174
{error && <div className="alert alert-error mt-6 max-w-100 self-center">{error}</div>}
175175
{doc && (
176-
<div className="flex grow items-start justify-center">
177-
<div className="mx-0 flex min-h-full max-w-200 shrink grow flex-col overflow-hidden p-4 sm:mx-2 md:mx-4 lg:mx-8">
178-
<nav className="breadcrumbs text-sm" aria-label="Breadcrumbs">
176+
<div className="flex grow items-start overflow-hidden">
177+
<div className="mx-auto flex h-full min-h-full max-w-200 grow flex-col overflow-y-auto px-4 pt-2 pb-8 sm:px-4 md:px-8 lg:px-12 print:px-4">
178+
<nav className="breadcrumbs shrink-0 text-sm" aria-label="Breadcrumbs">
179179
<ul className="flex-wrap">
180180
<li>
181181
<Link to="/">Home</Link>
@@ -251,7 +251,7 @@ export default function DocPage() {
251251
</li>
252252
</ul>
253253
</div>
254-
<aside className="border-base-300 sticky top-0 me-[-8px] hidden max-h-[calc(100vh-4em)] w-50 shrink-0 overflow-y-auto border-l p-4 lg:block">
254+
<aside className="border-base-300 hidden max-h-full w-50 shrink-0 overflow-y-auto border-l p-4 lg:block print:hidden">
255255
<h2 className="text-md text-secondary mb-2 font-semibold">In this page</h2>
256256
<ul className="list-none pl-4 text-gray-500">
257257
{doc.metadata.subtitles.map((heading) => (

frontend/src/pages/NewDocPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default function NewDocPage() {
9191
}, [parentId, documents, title])
9292

9393
return (
94-
<div className="card bg-base-200 m-4 shadow-lg">
94+
<div className="card bg-base-200 m-4 max-h-full overflow-y-auto shadow-lg">
9595
<form className="card-body flex flex-col gap-4" onSubmit={submit} role="form">
9696
<div className="card-title">
9797
<h2 className="text-2xl font-bold">Create New Document</h2>

frontend/src/pages/UploadsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export default function UploadsPage() {
130130
}
131131
}
132132
return (
133-
<div className="card border-base-300 bg-base-200 m-4 shadow-lg">
133+
<div className="card border-base-300 bg-base-200 m-4 max-h-full overflow-y-auto shadow-lg">
134134
<div className="card-body">
135135
<div className="mb-4 flex items-center justify-between">
136136
<h1 className="card-title">Uploads</h1>

frontend/src/pages/UsersPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export default function UsersPage() {
132132
}
133133
}
134134
return (
135-
<div className="card border-base-300 bg-base-200 m-4 border shadow-lg">
135+
<div className="card border-base-300 bg-base-200 m-4 max-h-full overflow-y-auto border shadow-lg">
136136
<div className="card-body">
137137
<div className="mb-4 flex items-center justify-between">
138138
<h2 className="card-title text-2xl">Users</h2>

0 commit comments

Comments
 (0)