Skip to content

Commit

Permalink
feat: update Table Row component styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Rickk137 committed Nov 7, 2023
1 parent 8abf5e4 commit 9722aa9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 3 additions & 5 deletions packages/ui/src/2_molecules/TableBase/TableBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ export const TableBase = <RowType extends RowObject>({
const handleRowClick = useCallback(
(row: RowType) => {
onRowClick?.(row);

console.log('index', rows?.indexOf(row));

setSelectedIndex(rows?.indexOf(row));
const index = rows?.indexOf(row);
setSelectedIndex(index === selectedIndex ? undefined : index);
},
[onRowClick, rows],
[onRowClick, rows, selectedIndex],
);

return (
Expand Down
5 changes: 3 additions & 2 deletions packages/ui/src/2_molecules/TableRow/TableRow.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.row {
@apply cursor-pointer sm:cursor-auto outline outline-1 outline-gray-70 rounded text-xs font-medium;
@apply cursor-pointer sm:cursor-auto outline outline-1 outline-gray-70 rounded text-xs font-medium transition-colors;
transition-property: outline-color;

&.small > td {
@apply py-2.5 px-4;
Expand Down Expand Up @@ -29,7 +30,7 @@
}

.active {
@apply outline-gray-50 bg-gray-70;
outline-color: rgba(114, 234, 222, 0.5);
}

.expanded {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/2_molecules/TableRow/TableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const TableRow = <RowType extends RowObject>({
<tr
key={index}
className={classNames(styles.row, className, styles[size], {
[styles.clickable]: isClickable,
[styles.clickable]: isClickable || expandedContent,
[styles.active]: isClickable && isSelected,
[styles.expanded]: expandedRow && expandedContent,
})}
Expand Down

0 comments on commit 9722aa9

Please sign in to comment.