Skip to content

Table: omit opacity on IconButton in TableRow #566

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
37 changes: 27 additions & 10 deletions src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ const TableRow = styled.tr<TableRowProps>`
&:hover {
background-color: ${theme.click.table.row.color.background.hover};
}
opacity: ${$isDeleted || $isDisabled ? 0.5 : 1};
cursor: ${$isDeleted || $isDisabled ? "not-allowed" : "default"}
`}

Expand Down Expand Up @@ -209,12 +208,20 @@ const TableRow = styled.tr<TableRowProps>`
}
`;

const TableData = styled.td<{ $size: TableSize }>`
interface TableDataProps {
$size: TableSize;
$isDeleted?: boolean;
$isDisabled?: boolean;
Comment on lines +213 to +214
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a component interface perspective, do we need both of these properties? isDeleted seems kind of implementation specific. Couldn't isDisabled handle that? I'm not seeing isDeleted used on tables in CP.

Maybe @vineethasok or @gjones could answer

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'd try to keep it as simple as possible until there is a clear reason why we need a separate style between isDeleted and isDisabled, and if we decide there's a legit reason, they should look distinct from one another.

}
const TableData = styled.td<TableDataProps>`
overflow: hidden;
${({ theme, $size }) => `
${({ theme, $size, $isDeleted, $isDisabled }) => `
color: ${theme.click.table.row.color.text.default};
font: ${theme.click.table.cell.text.default};
padding: ${theme.click.table.body.cell.space[$size].y} ${theme.click.table.body.cell.space[$size].x};
padding: ${theme.click.table.body.cell.space[$size].y} ${
theme.click.table.body.cell.space[$size].x
};
opacity: ${$isDeleted || $isDisabled ? 0.5 : 1};
`}
@media (max-width: 768px) {
width: auto;
Expand Down Expand Up @@ -262,12 +269,15 @@ const Tbody = styled.tbody`
}
`;

const SelectData = styled.td<{ $size: TableSize }>`
const SelectData = styled.td<TableDataProps>`
overflow: hidden;
${({ theme, $size }) => `
color: ${theme.click.table.row.color.text.default};
${({ theme, $size, $isDeleted, $isDisabled }) => `
color: ${$isDeleted || $isDisabled ? "tomato" : "blue"};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does tomato and blue do here?

font: ${theme.click.table.cell.text.default};
padding: ${theme.click.table.body.cell.space[$size].y} ${theme.click.table.body.cell.space[$size].x};
padding: ${theme.click.table.body.cell.space[$size].y} ${
theme.click.table.body.cell.space[$size].x
};
opacity: ${$isDeleted || $isDisabled ? 0.5 : 1};
`}
@media (max-width: 768px) {
width: auto;
Expand Down Expand Up @@ -353,8 +363,9 @@ interface TableRowCloseButtonProps {
const TableRowCloseButton = styled.button<TableRowCloseButtonProps>`
svg {
transition: transform 200ms;
${({ $isDeleted }) => `
${({ $isDeleted, theme }) => `
${$isDeleted ? "transform: rotate(45deg)" : ""};
color: ${$isDeleted ? theme.click.table.header.color.title.default : ""}
`}
}
&:disabled {
Expand Down Expand Up @@ -447,7 +458,11 @@ const TableBodyRow = ({
{...rowProps}
>
{isSelectable && (
<SelectData $size={size}>
<SelectData
$size={size}
$isDeleted={isDeleted}
$isDisabled={isDisabled}
>
<Checkbox
checked={isSelected}
onCheckedChange={onSelect}
Expand All @@ -458,6 +473,8 @@ const TableBodyRow = ({
<TableData
$size={size}
key={`table-cell-${cellIndex}`}
$isDeleted={isDeleted}
$isDisabled={isDisabled}
{...cellProps}
>
{headers[cellIndex] && <MobileHeader>{headers[cellIndex].label}</MobileHeader>}
Expand Down