33 lines
749 B
TypeScript
33 lines
749 B
TypeScript
import { styled } from '@mui/material/styles';
|
|
import IconButton, { IconButtonProps } from '@mui/material/IconButton';
|
|
|
|
interface ExpandMoreProps extends IconButtonProps {
|
|
expand: boolean;
|
|
}
|
|
|
|
const ExpandMore = styled((props: ExpandMoreProps) => {
|
|
const { expand, ...other } = props;
|
|
return <IconButton {...other} />;
|
|
})(({ theme }) => ({
|
|
marginLeft: 'auto',
|
|
transition: theme.transitions.create('transform', {
|
|
duration: theme.transitions.duration.shortest,
|
|
}),
|
|
variants: [
|
|
{
|
|
props: ({ expand }) => !expand,
|
|
style: {
|
|
transform: 'rotate(0deg)',
|
|
},
|
|
},
|
|
{
|
|
props: ({ expand }) => !!expand,
|
|
style: {
|
|
transform: 'rotate(180deg)',
|
|
},
|
|
},
|
|
],
|
|
}));
|
|
|
|
export { ExpandMore };
|