34 lines
810 B
JavaScript
34 lines
810 B
JavaScript
|
|
import { styled, createTheme, ThemeProvider } from '@mui/material/styles';
|
||
|
|
import { deepPurple } from '@mui/material/colors';
|
||
|
|
import Avatar from '@mui/material/Avatar';
|
||
|
|
|
||
|
|
const customTheme = createTheme({
|
||
|
|
palette: {
|
||
|
|
primary: {
|
||
|
|
main: deepPurple[500],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
const StyledAvatar = styled(Avatar)`
|
||
|
|
${({ theme }) => `
|
||
|
|
cursor: pointer;
|
||
|
|
background-color: ${theme.palette.primary.main};
|
||
|
|
transition: ${theme.transitions.create(['background-color', 'transform'], {
|
||
|
|
duration: theme.transitions.duration.standard,
|
||
|
|
})};
|
||
|
|
&:hover {
|
||
|
|
background-color: ${theme.palette.secondary.main};
|
||
|
|
transform: scale(1.3);
|
||
|
|
}
|
||
|
|
`}
|
||
|
|
`;
|
||
|
|
|
||
|
|
export default function TransitionHover() {
|
||
|
|
return (
|
||
|
|
<ThemeProvider theme={customTheme}>
|
||
|
|
<StyledAvatar>OP</StyledAvatar>
|
||
|
|
</ThemeProvider>
|
||
|
|
);
|
||
|
|
}
|