refactor(web/context): context menu mantine rewrite

This commit is contained in:
Luke
2022-12-17 14:27:55 +01:00
parent c419474969
commit e7d86af637
4 changed files with 173 additions and 195 deletions

View File

@@ -0,0 +1,44 @@
import { Button, createStyles } from '@mantine/core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { IconProp } from '@fortawesome/fontawesome-svg-core';
interface Props {
icon: IconProp;
canClose?: boolean;
iconSize: number;
handleClick: () => void;
}
const useStyles = createStyles((theme, params: { canClose?: boolean }) => ({
button: {
borderRadius: 4,
flex: '1 15%',
alignSelf: 'stretch',
height: 'auto',
textAlign: 'center',
justifyContent: 'center',
padding: 2,
},
label: {
color: params.canClose ? theme.colors.dark[0] : theme.colors.dark[2],
},
}));
const HeaderButton: React.FC<Props> = ({ icon, canClose, iconSize, handleClick }) => {
const { classes } = useStyles({ canClose });
return (
<Button
variant="default"
className={classes.button}
classNames={{ label: classes.label }}
disabled={canClose === false}
onClick={handleClick}
>
<FontAwesomeIcon icon={icon} fontSize={iconSize} fixedWidth />
</Button>
);
};
export default HeaderButton;