PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.15
Yatra – Travel Booking & Tour Operator Software v3.0.15
3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 All 83 releases
yatra / resources / js / components / ui / switch.tsx

switch.tsx in Yatra – Travel Booking & Tour Operator Software 3.0.15, at resources/js/components/ui/switch.tsx

37 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React from "react";
2
3 interface SwitchProps {
4 checked: boolean;
5 onCheckedChange: (checked: boolean) => void;
6 disabled?: boolean;
7 className?: string;
8 }
9
10 export const Switch: React.FC<SwitchProps> = ({
11 checked,
12 onCheckedChange,
13 disabled = false,
14 className = "",
15 }) => {
16 return (
17 <button
18 type="button"
19 role="switch"
20 aria-checked={checked}
21 disabled={disabled}
22 onClick={() => !disabled && onCheckedChange(!checked)}
23 className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${
24 checked
25 ? "bg-blue-600 dark:bg-blue-500"
26 : "bg-gray-200 dark:bg-gray-700"
27 } ${className}`}
28 >
29 <span
30 className={`inline-block h-5 w-5 transform rounded-full bg-white shadow-lg transition-transform ${
31 checked ? "translate-x-5" : "translate-x-0.5"
32 }`}
33 />
34 </button>
35 );
36 };
37