UNPKG

pagamio-frontend-commons-lib

Version:

Pagamio library for Frontend reusable components like the form engine and table container

11 lines (10 loc) 793 B
import { jsx as _jsx } from "react/jsx-runtime"; import * as SwitchPrimitive from '@radix-ui/react-switch'; const CustomSwitch = ({ checked, onCheckedChange, themeColor }) => { return (_jsx(SwitchPrimitive.Root, { className: `relative inline-flex h-6 w-11 items-center rounded-full border-2 transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500`, checked: checked, onCheckedChange: onCheckedChange, style: { backgroundColor: checked ? themeColor : '#E5E7EB', }, children: _jsx(SwitchPrimitive.Thumb, { className: `block h-4 w-4 rounded-full border-transparent bg-white transition-transform ${checked ? 'translate-x-5' : 'translate-x-1'}`, style: { border: `2px solid ${themeColor}`, } }) })); }; export default CustomSwitch;