feat: total services amount and recalculating
This commit is contained in:
34
src/components/LockCheckbox/LockCheckbox.tsx
Normal file
34
src/components/LockCheckbox/LockCheckbox.tsx
Normal 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;
|
||||
Reference in New Issue
Block a user