Skip to content

Commit

Permalink
Disable ripple effect
Browse files Browse the repository at this point in the history
Closes #5587
  • Loading branch information
fzaninotto committed Nov 27, 2020
1 parent a0940d3 commit d86309c
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
52 changes: 52 additions & 0 deletions examples/demo/src/layout/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,32 @@ export const darkTheme = {
backgroundColor: '#616161e6',
},
},
MuiButtonBase: {
root: {
'&:hover:active::after': {
// recreate a static ripple color
// use the currentColor to make it work both for outlined and contained buttons
// but to dim the background without dimming the text,
// put another element on top with a limited opacity
content: '""',
display: 'block',
width: '100%',
height: '100%',
position: 'absolute',
top: 0,
right: 0,
backgroundColor: 'currentColor',
opacity: 0.3,
borderRadius: 'inherit',
},
},
},
},
props: {
MuiButtonBase: {
// disable ripple for perf reasons
disableRipple: true,
},
},
};

Expand Down Expand Up @@ -62,6 +88,26 @@ export const lightTheme = {
boxShadow: 'none',
},
},
MuiButtonBase: {
root: {
'&:hover:active::after': {
// recreate a static ripple color
// use the currentColor to make it work both for outlined and contained buttons
// but to dim the background without dimming the text,
// put another element on top with a limited opacity
content: '""',
display: 'block',
width: '100%',
height: '100%',
position: 'absolute',
top: 0,
right: 0,
backgroundColor: 'currentColor',
opacity: 0.3,
borderRadius: 'inherit',
},
},
},
MuiAppBar: {
colorSecondary: {
color: '#808080',
Expand All @@ -85,4 +131,10 @@ export const lightTheme = {
},
},
},
props: {
MuiButtonBase: {
// disable ripple for perf reasons
disableRipple: true,
},
},
};
26 changes: 26 additions & 0 deletions packages/ra-ui-materialui/src/defaultTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,32 @@ export default {
},
},
},
MuiButtonBase: {
root: {
'&:hover:active::after': {
// recreate a static ripple color
// use the currentColor to make it work both for outlined and contained buttons
// but to dim the background without dimming the text,
// put another element on top with a limited opacity
content: '""',
display: 'block',
width: '100%',
height: '100%',
position: 'absolute',
top: 0,
right: 0,
backgroundColor: 'currentColor',
opacity: 0.3,
borderRadius: 'inherit',
},
},
},
},
props: {
MuiButtonBase: {
// disable ripple for perf reasons
disableRipple: true,
},
},
};

Expand Down

0 comments on commit d86309c

Please sign in to comment.