Files
react-test/docs/data/material/customization/transitions/TransitionHover.tsx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
810 B
TypeScript
Raw Normal View History

2025-12-12 14:26:25 +09:00
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>
);
}