feishin/src/renderer/components/checkbox/index.tsx

33 lines
812 B
TypeScript
Raw Normal View History

2023-05-11 02:51:00 -07:00
import { forwardRef } from 'react';
import { Checkbox as MantineCheckbox, CheckboxProps } from '@mantine/core';
import styled from 'styled-components';
const StyledCheckbox = styled(MantineCheckbox)`
2023-07-01 19:10:05 -07:00
& .mantine-Checkbox-input {
background-color: var(--input-bg);
2023-05-11 02:51:00 -07:00
2023-07-01 19:10:05 -07:00
&:checked {
background-color: var(--primary-color);
border-color: var(--primary-color);
}
2023-05-11 02:51:00 -07:00
2023-07-01 19:10:05 -07:00
&:hover:not(:checked) {
background-color: var(--primary-color);
opacity: 0.5;
}
2023-05-11 02:51:00 -07:00
2023-07-01 19:10:05 -07:00
transition: none;
}
2023-05-11 02:51:00 -07:00
`;
export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
2023-07-01 19:10:05 -07:00
({ ...props }: CheckboxProps, ref) => {
return (
<StyledCheckbox
ref={ref}
{...props}
/>
);
},
2023-05-11 02:51:00 -07:00
);