Skip to content

Commit a4418b6

Browse files
committed
refactor: replace extra main container query with content container query
1 parent 55f9863 commit a4418b6

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

src/components/data-table/pagination.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ export function DataTablePagination<TData>({
3030
<div
3131
className={cn(
3232
'flex items-center justify-between overflow-clip px-2',
33-
'@max-2xl/main:flex-col-reverse @max-2xl/main:gap-4'
33+
'@max-2xl/content:flex-col-reverse @max-2xl/content:gap-4'
3434
)}
3535
style={{ overflowClipMargin: 1 }}
3636
>
3737
<div className='flex w-full items-center justify-between'>
38-
<div className='flex w-[100px] items-center justify-center text-sm font-medium @2xl/main:hidden'>
38+
<div className='flex w-[100px] items-center justify-center text-sm font-medium @2xl/content:hidden'>
3939
Page {currentPage} of {totalPages}
4040
</div>
41-
<div className='flex items-center gap-2 @max-2xl/main:flex-row-reverse'>
41+
<div className='flex items-center gap-2 @max-2xl/content:flex-row-reverse'>
4242
<Select
4343
value={`${table.getState().pagination.pageSize}`}
4444
onValueChange={(value) => {
@@ -61,13 +61,13 @@ export function DataTablePagination<TData>({
6161
</div>
6262

6363
<div className='flex items-center sm:space-x-6 lg:space-x-8'>
64-
<div className='flex w-[100px] items-center justify-center text-sm font-medium @max-3xl/main:hidden'>
64+
<div className='flex w-[100px] items-center justify-center text-sm font-medium @max-3xl/content:hidden'>
6565
Page {currentPage} of {totalPages}
6666
</div>
6767
<div className='flex items-center space-x-2'>
6868
<Button
6969
variant='outline'
70-
className='size-8 p-0 @max-md/main:hidden'
70+
className='size-8 p-0 @max-md/content:hidden'
7171
onClick={() => table.setPageIndex(0)}
7272
disabled={!table.getCanPreviousPage()}
7373
>
@@ -113,7 +113,7 @@ export function DataTablePagination<TData>({
113113
</Button>
114114
<Button
115115
variant='outline'
116-
className='size-8 p-0 @max-md/main:hidden'
116+
className='size-8 p-0 @max-md/content:hidden'
117117
onClick={() => table.setPageIndex(table.getPageCount() - 1)}
118118
disabled={!table.getCanNextPage()}
119119
>

src/components/layout/authenticated-layout.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@ export function AuthenticatedLayout({ children }: AuthenticatedLayoutProps) {
4545
</AppSidebar>
4646
<SidebarInset
4747
className={cn(
48+
// Set content container, so we can use container queries
49+
'@container/content',
50+
4851
// If layout is fixed, set the height
4952
// to 100svh to prevent overflow
5053
'has-[[data-layout=fixed]]:h-svh',
5154

5255
// If layout is fixed and sidebar is inset,
53-
// set the height to 100svh - 1rem (total margins) to prevent overflow
54-
// '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))]',
56-
57-
// Set content container, so we can use container queries
58-
'@container/content'
56+
// set the height to 100svh - spacing (total margins) to prevent overflow
57+
'peer-data-[variant=inset]:has-[[data-layout=fixed]]:h-[calc(100svh-(var(--spacing)*4))]'
5958
)}
6059
>
6160
{children ?? <Outlet />}

src/components/layout/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function Main({ fixed, className, fluid, ...props }: MainProps) {
1111
<main
1212
data-layout={fixed ? 'fixed' : 'auto'}
1313
className={cn(
14-
'@container/main px-4 py-6',
14+
'px-4 py-6',
1515

1616
// If layout is fixed, make the main container flex and grow
1717
fixed && 'flex grow flex-col overflow-hidden',

0 commit comments

Comments
 (0)