Files
ERitors-Scribe-Desktop/components/form/CheckBox.tsx
natreex 64ed90d993 Remove unused components and models for improved maintainability
- Deleted redundant components (`AddActionButton`, `AlertBox`, `AlertStack`, `BackButton`, `CancelButton`, and `CollapsableArea`) and related files.
- Removed unused models (`Book`, `BookSerie`, `BookTables`, `Character`, and `Chapter`) to reduce codebase clutter.
- Updated project structure and references to reflect these removals.
2026-03-22 22:37:31 -04:00

54 lines
1.9 KiB
TypeScript

import React, {Dispatch, SetStateAction} from "react";
interface CheckBoxProps {
isChecked: boolean;
setIsChecked: Dispatch<SetStateAction<boolean>>;
label: string;
description: string;
id: string;
}
export default function CheckBox(
{
isChecked,
setIsChecked,
label,
description,
id,
}: CheckBoxProps) {
return (
<div className="flex items-center group">
<div className="relative inline-block w-12 mr-3 align-middle select-none">
<input
type="checkbox"
id={id}
checked={isChecked}
onChange={() => setIsChecked(!isChecked)}
className="hidden"
/>
<label htmlFor={id}
className={`block overflow-hidden h-6 rounded-full cursor-pointer transition-colors duration-150 border-2 ${
isChecked
? 'bg-primary border-primary'
: 'bg-secondary border-secondary hover:bg-secondary'
}`}
>
<span
className={`absolute block h-5 w-5 rounded-full bg-text-primary transform transition-all duration-200 top-0.5 ${
isChecked ? 'right-0.5' : 'left-0.5'
}`}/>
</label>
</div>
<div className="flex-1">
<label htmlFor={id}
className="text-text-primary text-sm font-medium cursor-pointer group-hover:text-primary transition-colors">
{label}
</label>
<p className="text-text-secondary text-xs mt-0.5 hidden md:block">
{description}
</p>
</div>
</div>
)
}