0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

refactor(console): table hover behaviors (#2938)

This commit is contained in:
Xiao Yijun 2023-01-16 13:42:06 +08:00 committed by GitHub
parent 102019108c
commit a6affa0189
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 19 deletions

View file

@ -67,29 +67,29 @@
&.clickable {
cursor: pointer;
}
}
&:hover {
background: var(--color-hover);
tr.hoverEffect:hover {
background: var(--color-hover);
td {
border-top: 1px solid transparent;
}
td {
border-top: 1px solid transparent;
}
+ tr {
td {
border-top: 1px solid transparent;
}
}
td:first-child {
border-radius: 8px 0 0 8px;
}
td:last-child {
border-radius: 0 8px 8px 0;
}
+ tr {
td {
border-top: 1px solid transparent;
}
}
td:first-child {
border-radius: 8px 0 0 8px;
}
td:last-child {
border-radius: 0 8px 8px 0;
}
}
}
}

View file

@ -28,6 +28,7 @@ type Props<
columns: Array<Column<TFieldValues>>;
rowIndexKey: TName;
filter?: ReactNode;
isRowHoverEffectDisabled?: boolean;
isRowClickable?: (row: TFieldValues) => boolean;
rowClickHandler?: (row: TFieldValues) => void;
className?: string;
@ -48,6 +49,7 @@ const Table = <
columns,
rowIndexKey,
filter,
isRowHoverEffectDisabled = false,
rowClickHandler,
isRowClickable = () => Boolean(rowClickHandler),
className,
@ -130,7 +132,10 @@ const Table = <
return (
<tr
key={row[rowIndexKey]}
className={classNames(rowClickable && styles.clickable)}
className={classNames(
rowClickable && styles.clickable,
!isRowHoverEffectDisabled && styles.hoverEffect
)}
onClick={onClick}
>
{columns.map(({ dataIndex, colSpan, className, render }) => (

View file

@ -177,6 +177,7 @@ const LanguageDetails = () => {
</div>
<div className={styles.container}>
<Table
isRowHoverEffectDisabled
className={styles.content}
headerClassName={styles.tableWrapper}
bodyClassName={styles.tableWrapper}