feat: sticky tank cards

This commit is contained in:
TrèsAbhi committed 2024-07-02 20:07:16 -05:00
1 parent ac243a3cdd
commit 127ffc787e
4 files changed
+48 -16

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
'use client';
import { Table } from '@radix-ui/themes';
import { RootProps } from '@radix-ui/themes/dist/cjs/components/table';
import { useEffect, useRef } from 'react';
export function StickyTableRoot(props: RootProps) {
const table = useRef<HTMLTableElement>(null);
useEffect(() => {
table.current
?.querySelector('table')
?.style.setProperty('overflow', 'auto');
}, []);
return <Table.Root {...props} ref={table} />;
}
+8 -1
View File
@@ -13,7 +13,14 @@ export function TankRowHeaderCell({ tank }: TankRowHeaderCellProps) {
const Icon = classIcons[tank.class];
return (
<Table.RowHeaderCell style={{ display: 'flex' }}>
<Table.RowHeaderCell
style={{
display: 'flex',
position: 'sticky',
left: 0,
backgroundColor: 'var(--color-background)',
}}
>
<Link href={`/tools/tankopedia/${tank.id}`} tabIndex={-1}>
<img
alt={tank.name}