Skip to content

fix: style table component to figma design #16417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions site/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ export const Table = React.forwardRef<
HTMLTableElement,
React.HTMLAttributes<HTMLTableElement>
>(({ className, ...props }, ref) => (
<div className="relative w-full overflow-auto border border-border border-solid rounded-md">
<div className="relative w-full overflow-auto">
<table
ref={ref}
className={cn(
"w-full caption-bottom text-xs font-medium text-content-secondary border-collapse",
"w-full caption-bottom text-xs font-medium text-content-secondary border-separate border-spacing-0",
className,
)}
{...props}
Expand All @@ -26,7 +26,7 @@ export const TableHeader = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
<thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
<thead ref={ref} className={cn("[&_td]:border-none", className)} {...props} />
));

export const TableBody = React.forwardRef<
Expand All @@ -35,7 +35,13 @@ export const TableBody = React.forwardRef<
>(({ className, ...props }, ref) => (
<tbody
ref={ref}
className={cn("[&_tr:last-child]:border-0", className)}
className={cn(
"[&>tr:first-child>td]:border-t [&>tr>td:first-child]:border-l",
"[&>tr:last-child>td]:border-b [&>tr>td:last-child]:border-r",
"[&>tr:first-child>td:first-child]:rounded-tl-md [&>tr:first-child>td:last-child]:rounded-tr-md",
"[&>tr:last-child>td:first-child]:rounded-bl-md [&>tr:last-child>td:last-child]:rounded-br-md",
className,
)}
{...props}
/>
));
Expand Down Expand Up @@ -91,6 +97,7 @@ export const TableCell = React.forwardRef<
<td
ref={ref}
className={cn(
"border-0 border-t border-border border-solid",
"py-2 px-4 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
className,
)}
Expand Down
Loading