-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLayout.tsx
More file actions
36 lines (32 loc) · 1.53 KB
/
Layout.tsx
File metadata and controls
36 lines (32 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import type { PropsWithChildren } from 'react';
import { Sidebar } from '@dar/sidebar';
import { LegacyAdminBanner } from './LegacyAdminBanner';
// App shell: the navigation chrome (@dar/sidebar) plus the page content
// region, with an optional escape-hatch banner (#577) at the top of the
// content column when the consumer set
// `DJANGO_ADMIN_REACT["LEGACY_ADMIN_URL_PREFIX"]`. The banner returns
// null when the setting is unset, so it costs nothing for consumers
// who haven't enabled it.
export function Layout({ children }: PropsWithChildren) {
return (
<div className="flex h-full min-h-screen">
<Sidebar />
{/* Content. Extra top padding on mobile + tablet clears the fixed
top bar (shown until lg).
`min-w-0` is load-bearing (#672): a flex item defaults to
`min-width: auto`, so `main` refuses to shrink below the
intrinsic width of its widest content. A detail-page toolbar
with 12+ action buttons makes that intrinsic width exceed the
viewport, so `flex-1` blew `main` PAST the viewport edge and
dragged the whole content column — title and breadcrumb
included — off-screen, no matter how the header rows were
stacked. `min-w-0` lets `main` shrink to the available width so
the toolbar's `flex-wrap` can actually wrap instead of
overflowing horizontally. */}
<main className="min-w-0 flex-1 overflow-y-auto p-6 pt-20 lg:pt-6">
<LegacyAdminBanner />
{children}
</main>
</div>
);
}