From 3dcd0e5228ba58a37e55193f99573845a825693e Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Fri, 15 Mar 2019 11:33:44 +0100 Subject: [PATCH] Add hover styles to sorting arrow Feature #14971 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- src/components/data-table/data-table.tsx | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/components/data-table/data-table.tsx b/src/components/data-table/data-table.tsx index a0d047ce..3cce8f3d 100644 --- a/src/components/data-table/data-table.tsx +++ b/src/components/data-table/data-table.tsx @@ -3,12 +3,15 @@ // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; -import { Table, TableBody, TableRow, TableCell, TableHead, TableSortLabel, StyleRulesCallback, Theme, WithStyles, withStyles } from '@material-ui/core'; +import { Table, TableBody, TableRow, TableCell, TableHead, TableSortLabel, StyleRulesCallback, Theme, WithStyles, withStyles, IconButton } from '@material-ui/core'; +import classnames from 'classnames'; import { DataColumn, SortDirection } from './data-column'; import { DataTableDefaultView } from '../data-table-default-view/data-table-default-view'; import { DataTableFilters } from '../data-table-filters/data-table-filters-tree'; import { DataTableFiltersPopover } from '../data-table-filters/data-table-filters-popover'; import { countNodes } from '~/models/tree'; +import { SvgIconProps } from '@material-ui/core/SvgIcon'; +import ArrowDownwardIcon from '@material-ui/icons/ArrowDownward'; export type DataColumns = Array>; @@ -32,7 +35,7 @@ export interface DataTableDataProps { currentRoute?: string; } -type CssRules = "tableBody" | "root" | "content" | "noItemsInfo" | 'tableCell'; +type CssRules = "tableBody" | "root" | "content" | "noItemsInfo" | 'tableCell' | 'arrow' | 'arrowButton'; const styles: StyleRulesCallback = (theme: Theme) => ({ root: { @@ -52,6 +55,12 @@ const styles: StyleRulesCallback = (theme: Theme) => ({ }, tableCell: { wordWrap: 'break-word' + }, + arrow: { + margin: 0 + }, + arrowButton: { + color: theme.palette.text.primary } }); @@ -81,7 +90,7 @@ export const DataTable = withStyles(styles)( renderNoItemsPlaceholder = () => { return this.props.defaultView ? this.props.defaultView - : ; + : ; } renderHeadCell = (column: DataColumn, index: number) => { @@ -103,6 +112,8 @@ export const DataTable = withStyles(styles)( ? onSortToggle && onSortToggle(column)}> @@ -114,6 +125,12 @@ export const DataTable = withStyles(styles)( ; } + ArrowIcon = ({className, ...props}: SvgIconProps) => ( + + + + ) + renderBodyRow = (item: any, index: number) => { const { onRowClick, onRowDoubleClick, extractKey, classes, currentItemUuid } = this.props; return