Skip to content

Commit ce5b945

Browse files
committed
fix: add max-width for large screens to improve responsiveness (#194)
1 parent 664927c commit ce5b945

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/components/layout/authenticated-layout.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ export function AuthenticatedLayout({ children }: Props) {
5252
// If layout is fixed and sidebar is inset,
5353
// set the height to 100svh - 1rem (total margins) to prevent overflow
5454
// 'peer-data-[variant=inset]:has-[[data-layout=fixed]]:h-[calc(100svh-1rem)]',
55-
'peer-data-[variant=inset]:has-[[data-layout=fixed]]:h-[calc(100svh-(var(--spacing)*4))]'
55+
'peer-data-[variant=inset]:has-[[data-layout=fixed]]:h-[calc(100svh-(var(--spacing)*4))]',
56+
57+
// Set content container, so we can use container queries
58+
'@container/content'
5659
)}
5760
>
5861
{children ?? <Outlet />}

src/components/layout/main.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,23 @@ import { cn } from '@/lib/utils'
33

44
interface MainProps extends React.HTMLAttributes<HTMLElement> {
55
fixed?: boolean
6+
fluid?: boolean
67
ref?: React.Ref<HTMLElement>
78
}
89

9-
export const Main = ({ fixed, className, ...props }: MainProps) => {
10+
export const Main = ({ fixed, className, fluid, ...props }: MainProps) => {
1011
return (
1112
<main
1213
data-layout={fixed ? 'fixed' : 'auto'}
1314
className={cn(
1415
'px-4 py-6',
16+
17+
// If layout is fixed, make the main container flex and grow
1518
fixed && 'flex grow flex-col overflow-hidden',
19+
20+
// If layout is not fluid, set the max-width
21+
!fluid &&
22+
'@7xl/content:mx-auto @7xl/content:w-full @7xl/content:max-w-7xl',
1623
className
1724
)}
1825
{...props}

0 commit comments

Comments
 (0)