Add option to reset image filters to default

This commit is contained in:
schroda
2024-12-17 16:48:03 +01:00
parent 8ca0c58ee0
commit f72977c7ce
10 changed files with 70 additions and 10 deletions

View File

@@ -9,12 +9,28 @@
import Button, { ButtonProps } from '@mui/material/Button';
import { useTranslation } from 'react-i18next';
import RestartAltIcon from '@mui/icons-material/RestartAlt';
import Tooltip from '@mui/material/Tooltip';
import IconButton, { IconButtonProps } from '@mui/material/IconButton';
export const ResetButton = (props: ButtonProps) => {
type PropsIconButton = { asIconButton: true } & IconButtonProps;
type PropsButton = { asIconButton?: false } & ButtonProps;
type Props = PropsIconButton | PropsButton;
export const ResetButton = ({ asIconButton, ...props }: Props) => {
const { t } = useTranslation();
if (asIconButton) {
return (
<Tooltip title={t('global.button.reset')}>
<IconButton color="inherit" {...props}>
<RestartAltIcon />
</IconButton>
</Tooltip>
);
}
return (
<Button startIcon={<RestartAltIcon />} {...props}>
<Button startIcon={<RestartAltIcon />} {...(props as ButtonProps)}>
{t('global.button.reset')}
</Button>
);