Skip to content

Commit e35bfbc

Browse files
elmeerrEsoterikStare
authored andcommitted
[TableRow] Improve hover/selected styles (mui#19277)
1 parent 31a8d27 commit e35bfbc

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

packages/material-ui/src/TableRow/TableRow.js

+5-10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
33
import clsx from 'clsx';
44
import withStyles from '../styles/withStyles';
55
import Tablelvl2Context from '../Table/Tablelvl2Context';
6+
import { fade } from '../styles/colorManipulator';
67

78
export const styles = theme => ({
89
/* Styles applied to the root element. */
@@ -12,17 +13,11 @@ export const styles = theme => ({
1213
verticalAlign: 'middle',
1314
// We disable the focus ring for mouse, touch and keyboard users.
1415
outline: 0,
15-
'&$selected': {
16-
backgroundColor:
17-
theme.palette.type === 'light'
18-
? 'rgba(0, 0, 0, 0.04)' // grey[100]
19-
: 'rgba(255, 255, 255, 0.08)',
20-
},
2116
'&$hover:hover': {
22-
backgroundColor:
23-
theme.palette.type === 'light'
24-
? 'rgba(0, 0, 0, 0.07)' // grey[200]
25-
: 'rgba(255, 255, 255, 0.14)',
17+
backgroundColor: theme.palette.action.hover,
18+
},
19+
'&$selected,&$selected:hover': {
20+
backgroundColor: fade(theme.palette.secondary.main, theme.palette.action.selectedOpacity),
2621
},
2722
},
2823
/* Pseudo-class applied to the root element if `selected={true}`. */

packages/material-ui/src/styles/createPalette.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ export const light = {
3434
// The color of an active action like an icon button.
3535
active: 'rgba(0, 0, 0, 0.54)',
3636
// The color of an hovered action.
37-
hover: 'rgba(0, 0, 0, 0.08)',
38-
hoverOpacity: 0.08,
37+
hover: 'rgba(0, 0, 0, 0.04)',
38+
hoverOpacity: 0.04,
3939
// The color of a selected action.
40-
selected: 'rgba(0, 0, 0, 0.14)',
40+
selected: 'rgba(0, 0, 0, 0.08)',
41+
selectedOpacity: 0.08,
4142
// The color of a disabled action.
4243
disabled: 'rgba(0, 0, 0, 0.26)',
4344
// The background color of a disabled action.
@@ -60,9 +61,10 @@ export const dark = {
6061
},
6162
action: {
6263
active: common.white,
63-
hover: 'rgba(255, 255, 255, 0.1)',
64-
hoverOpacity: 0.1,
65-
selected: 'rgba(255, 255, 255, 0.2)',
64+
hover: 'rgba(255, 255, 255, 0.08)',
65+
hoverOpacity: 0.08,
66+
selected: 'rgba(255, 255, 255, 0.16)',
67+
selectedOpacity: 0.16,
6668
disabled: 'rgba(255, 255, 255, 0.3)',
6769
disabledBackground: 'rgba(255, 255, 255, 0.12)',
6870
},

0 commit comments

Comments
 (0)