feat: total services amount and recalculating

This commit is contained in:
2024-10-22 19:31:51 +03:00
parent aa6f0364b5
commit bb34f12274
10 changed files with 153 additions and 43 deletions

View File

@@ -0,0 +1,34 @@
import { ActionIcon, ActionIconVariant, CheckboxProps, Tooltip } from "@mantine/core";
import { FC } from "react";
import { IconLock, IconLockOpen } from "@tabler/icons-react";
type RestProps = {
value?: boolean;
onChange?: (value: boolean) => void;
variant: ActionIconVariant
}
type Props = Omit<CheckboxProps, "onChange" | "value" | "variant"> & RestProps;
const LockCheckbox: FC<Props> = (props) => {
const { value = false } = props;
const getIcon = () => {
return value ? <IconLock /> : <IconLockOpen />;
};
const handleChange = () => {
if (props.onChange) {
props.onChange(!value);
}
};
return (
<Tooltip label={props.label}>
<ActionIcon
onClick={handleChange}
variant={props.variant}>
{getIcon()}
</ActionIcon>
</Tooltip>
);
};
export default LockCheckbox;