mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-08 13:00:13 +02:00
add hover only columns
This commit is contained in:
@@ -2,7 +2,7 @@ import {
|
|||||||
ItemTableListInnerColumn,
|
ItemTableListInnerColumn,
|
||||||
TableColumnContainer,
|
TableColumnContainer,
|
||||||
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
||||||
import { Icon } from '/@/shared/components/icon/icon';
|
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
||||||
|
|
||||||
export const ActionsColumn = (props: ItemTableListInnerColumn) => {
|
export const ActionsColumn = (props: ItemTableListInnerColumn) => {
|
||||||
const row: any = (props.data as (any | undefined)[])[props.rowIndex];
|
const row: any = (props.data as (any | undefined)[])[props.rowIndex];
|
||||||
@@ -10,7 +10,15 @@ export const ActionsColumn = (props: ItemTableListInnerColumn) => {
|
|||||||
if (row !== undefined) {
|
if (row !== undefined) {
|
||||||
return (
|
return (
|
||||||
<TableColumnContainer {...props}>
|
<TableColumnContainer {...props}>
|
||||||
<Icon icon="ellipsisHorizontal" size="sm" />
|
<ActionIcon
|
||||||
|
className="hover-only"
|
||||||
|
icon="ellipsisHorizontal"
|
||||||
|
iconProps={{
|
||||||
|
color: 'muted',
|
||||||
|
}}
|
||||||
|
size="lg"
|
||||||
|
variant="transparent"
|
||||||
|
/>
|
||||||
</TableColumnContainer>
|
</TableColumnContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
ItemTableListInnerColumn,
|
ItemTableListInnerColumn,
|
||||||
TableColumnContainer,
|
TableColumnContainer,
|
||||||
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
} from '/@/renderer/components/item-list/item-table-list/item-table-list-column';
|
||||||
import { Icon } from '/@/shared/components/icon/icon';
|
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
|
||||||
|
|
||||||
export const FavoriteColumn = (props: ItemTableListInnerColumn) => {
|
export const FavoriteColumn = (props: ItemTableListInnerColumn) => {
|
||||||
const row: boolean | undefined = (props.data as (any | undefined)[])[props.rowIndex]?.[
|
const row: boolean | undefined = (props.data as (any | undefined)[])[props.rowIndex]?.[
|
||||||
@@ -12,7 +12,16 @@ export const FavoriteColumn = (props: ItemTableListInnerColumn) => {
|
|||||||
if (typeof row === 'boolean') {
|
if (typeof row === 'boolean') {
|
||||||
return (
|
return (
|
||||||
<TableColumnContainer {...props}>
|
<TableColumnContainer {...props}>
|
||||||
<Icon fill={row ? 'primary' : undefined} icon={'favorite'} size="md" />
|
<ActionIcon
|
||||||
|
className={row ? undefined : 'hover-only'}
|
||||||
|
icon="favorite"
|
||||||
|
iconProps={{
|
||||||
|
color: row ? 'primary' : 'muted',
|
||||||
|
fill: row ? 'primary' : undefined,
|
||||||
|
}}
|
||||||
|
size="lg"
|
||||||
|
variant="transparent"
|
||||||
|
/>
|
||||||
</TableColumnContainer>
|
</TableColumnContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const RatingColumn = (props: ItemTableListInnerColumn) => {
|
|||||||
if (typeof row === 'number' || row === null) {
|
if (typeof row === 'number' || row === null) {
|
||||||
return (
|
return (
|
||||||
<TableColumnContainer {...props}>
|
<TableColumnContainer {...props}>
|
||||||
<Rating readOnly value={row || 0} />
|
<Rating className={row ? undefined : 'hover-only-flex'} value={row || 0} />
|
||||||
</TableColumnContainer>
|
</TableColumnContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,3 +78,18 @@
|
|||||||
.header-content.right {
|
.header-content.right {
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.container :global(.hover-only),
|
||||||
|
.container :global(.hover-only-flex) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container.data-row:hover :global(.hover-only),
|
||||||
|
.container.data-row.row-hovered :global(.hover-only) {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container.data-row:hover :global(.hover-only-flex),
|
||||||
|
.container.data-row.row-hovered :global(.hover-only-flex) {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ const columnLabelMap: Record<TableColumn, ReactNode | string> = {
|
|||||||
[TableColumn.TRACK_NUMBER]: i18n.t('table.column.trackNumber', {
|
[TableColumn.TRACK_NUMBER]: i18n.t('table.column.trackNumber', {
|
||||||
postProcess: 'upperCase',
|
postProcess: 'upperCase',
|
||||||
}) as string,
|
}) as string,
|
||||||
[TableColumn.USER_FAVORITE]: <Icon fill="default" icon="favorite" size="md" />,
|
[TableColumn.USER_FAVORITE]: <Icon icon="favorite" size="md" />,
|
||||||
[TableColumn.USER_RATING]: i18n.t('table.column.rating', {
|
[TableColumn.USER_RATING]: i18n.t('table.column.rating', {
|
||||||
postProcess: 'upperCase',
|
postProcess: 'upperCase',
|
||||||
}) as string,
|
}) as string,
|
||||||
|
|||||||
Reference in New Issue
Block a user