From 3e65885e1fdd09d53afe674aaf202a5bfb811b78 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Fri, 28 Feb 2025 03:40:42 +0530 Subject: [PATCH] (feat:toggle) greener colors, flexible --- frontend/src/components/ToggleSwitch.tsx | 55 +++++++++++++++++------- frontend/tailwind.config.cjs | 19 ++++++-- 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/frontend/src/components/ToggleSwitch.tsx b/frontend/src/components/ToggleSwitch.tsx index 061d2563..8293ece2 100644 --- a/frontend/src/components/ToggleSwitch.tsx +++ b/frontend/src/components/ToggleSwitch.tsx @@ -6,9 +6,8 @@ type ToggleSwitchProps = { className?: string; label?: string; disabled?: boolean; - activeColor?: string; - inactiveColor?: string; - id?: string; + size?: 'small' | 'medium' | 'large'; + labelPosition?: 'left' | 'right'; }; const ToggleSwitch: React.FC = ({ @@ -17,17 +16,44 @@ const ToggleSwitch: React.FC = ({ className = '', label, disabled = false, - activeColor = 'bg-purple-30', - inactiveColor = 'bg-transparent', - id, + size = 'medium', + labelPosition = 'left', }) => { + // Size configurations + const sizeConfig = { + small: { + box: 'h-6 w-10', + toggle: 'h-4 w-4 left-1 top-1', + translate: 'translate-x-4', + }, + medium: { + box: 'h-8 w-14', + toggle: 'h-6 w-6 left-1 top-1', + translate: 'translate-x-full', + }, + large: { + box: 'h-10 w-16', + toggle: 'h-8 w-8 left-1 top-1', + translate: 'translate-x-full', + }, + }; + + const { box, toggle, translate } = sizeConfig[size]; + return (