Skip to content

Commit

Permalink
🐛 fix(components): add missing displayName
Browse files Browse the repository at this point in the history
  • Loading branch information
ythecombinator committed Nov 20, 2023
1 parent 07eecb9 commit 9e17e5b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/shared/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,6 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
}
);

Button.displayName = 'Button';

export default Button;
12 changes: 12 additions & 0 deletions src/components/shared/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ const Root = forwardRef<HTMLTableElement, HTMLAttributes<HTMLTableElement>>(({ c
</div>
));

Root.displayName = 'Table-Root';

const Header = forwardRef<HTMLTableSectionElement, HTMLAttributes<HTMLTableSectionElement>>(
({ className, ...props }, ref) => <thead ref={ref} className={classNames('[&_tr]:border-b', className)} {...props} />
);

Header.displayName = 'Table-Header';

const Body = forwardRef<HTMLTableSectionElement, HTMLAttributes<HTMLTableSectionElement>>(
({ className, ...props }, ref) => (
<tbody ref={ref} className={classNames('[&_tr:last-child]:border-0', className)} {...props} />
)
);

Body.displayName = 'Table-Body';

const Row = forwardRef<HTMLTableRowElement, HTMLAttributes<HTMLTableRowElement>>(({ className, ...props }, ref) => (
<tr
ref={ref}
Expand All @@ -26,6 +32,8 @@ const Row = forwardRef<HTMLTableRowElement, HTMLAttributes<HTMLTableRowElement>>
/>
));

Row.displayName = 'Table-Row';

const Head = forwardRef<HTMLTableCellElement, ThHTMLAttributes<HTMLTableCellElement>>(
({ className, ...props }, ref) => (
<th
Expand All @@ -39,10 +47,14 @@ const Head = forwardRef<HTMLTableCellElement, ThHTMLAttributes<HTMLTableCellElem
)
);

Head.displayName = 'Table-Head';

const Cell = forwardRef<HTMLTableCellElement, TdHTMLAttributes<HTMLTableCellElement>>(
({ className, ...props }, ref) => (
<td ref={ref} className={classNames('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)} {...props} />
)
);

Cell.displayName = 'Table-Cell';

export default { Root, Header, Body, Head, Row, Cell };

0 comments on commit 9e17e5b

Please sign in to comment.