Update themed components with refs and css
This commit is contained in:
39
lib/component/input/switch/InfoSwitch.tsx
Normal file
39
lib/component/input/switch/InfoSwitch.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { MattrixwvSwitchProps } from "$/types/InputTypes";
|
||||
import clsx from "clsx";
|
||||
import { forwardRef } from "react";
|
||||
import MattrixwvSwitch from "./MattrixwvSwitch";
|
||||
|
||||
|
||||
const InfoSwitch = forwardRef<HTMLButtonElement, MattrixwvSwitchProps>(({
|
||||
className,
|
||||
knobClassName,
|
||||
disabled,
|
||||
...props
|
||||
}, ref ) => {
|
||||
return (
|
||||
<MattrixwvSwitch
|
||||
{...props}
|
||||
className={clsx(
|
||||
"bg-gray-400",
|
||||
className,
|
||||
{
|
||||
"data-checked:bg-info": !disabled,
|
||||
"data-checked:bg-info-light/80": disabled
|
||||
}
|
||||
)}
|
||||
knobClassName={clsx(
|
||||
knobClassName,
|
||||
{
|
||||
"bg-white": !disabled,
|
||||
"bg-neutral-light": disabled
|
||||
}
|
||||
)}
|
||||
disabled={disabled}
|
||||
ref={ref}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
InfoSwitch.displayName = "InfoSwitch";
|
||||
|
||||
export default InfoSwitch;
|
||||
Reference in New Issue
Block a user