Add checkbox component
This commit is contained in:
parent
4eb90d20a2
commit
003fb26c60
2 changed files with 33 additions and 0 deletions
32
src/renderer/components/checkbox/index.tsx
Normal file
32
src/renderer/components/checkbox/index.tsx
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import { forwardRef } from 'react';
|
||||||
|
import { Checkbox as MantineCheckbox, CheckboxProps } from '@mantine/core';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const StyledCheckbox = styled(MantineCheckbox)`
|
||||||
|
& .mantine-Checkbox-input {
|
||||||
|
background-color: var(--input-bg);
|
||||||
|
|
||||||
|
&:checked {
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
border-color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover:not(:checked) {
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
|
||||||
|
({ ...props }: CheckboxProps, ref) => {
|
||||||
|
return (
|
||||||
|
<StyledCheckbox
|
||||||
|
ref={ref}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
|
@ -32,3 +32,4 @@ export * from './query-builder';
|
||||||
export * from './rating';
|
export * from './rating';
|
||||||
export * from './hover-card';
|
export * from './hover-card';
|
||||||
export * from './option';
|
export * from './option';
|
||||||
|
export * from './checkbox';
|
||||||
|
|
Reference in a new issue