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

30 lines
725 B
TypeScript
Raw Normal View History

2022-12-19 15:59:14 -08:00
import type { SwitchProps as MantineSwitchProps } from '@mantine/core';
2022-12-19 15:59:14 -08:00
import { Switch as MantineSwitch } from '@mantine/core';
import styled from 'styled-components';
type SwitchProps = MantineSwitchProps;
const StyledSwitch = styled(MantineSwitch)`
2023-07-01 19:10:05 -07:00
display: flex;
2022-12-19 15:59:14 -08:00
2023-07-01 19:10:05 -07:00
& .mantine-Switch-track {
background-color: var(--switch-track-bg);
border: none;
}
2022-12-19 15:59:14 -08:00
2023-07-01 19:10:05 -07:00
& .mantine-Switch-input {
&:checked + .mantine-Switch-track {
background-color: var(--switch-track-enabled-bg);
}
2022-12-19 15:59:14 -08:00
}
2023-07-01 19:10:05 -07:00
& .mantine-Switch-thumb {
background-color: var(--switch-thumb-bg);
}
2022-12-19 15:59:14 -08:00
`;
export const Switch = ({ ...props }: SwitchProps) => {
2023-07-01 19:10:05 -07:00
return <StyledSwitch {...props} />;
2022-12-19 15:59:14 -08:00
};