MCPcopy Create free account
hub / github.com/Sethispr/image-compressor / ToggleCard

Function ToggleCard

components/settings/ToggleCard.tsx:11–92  ·  view source on GitHub ↗
({
  active,
  onClick,
  title,
  description,
  icon: Icon,
  badge,
}: {
  active: boolean;
  onClick: () => void;
  title: string;
  description: React.ReactNode;
  icon: React.ElementType;
  badge?: string;
})

Source from the content-addressed store, hash-verified

9 * It indicates "On" or "Off" using borders and colors.
10 */
11export const ToggleCard = ({
12 active,
13 onClick,
14 title,
15 description,
16 icon: Icon,
17 badge,
18}: {
19 active: boolean;
20 onClick: () => void;
21 title: string;
22 description: React.ReactNode;
23 icon: React.ElementType;
24 badge?: string;
25}) => (
26 <button
27 onClick={onClick}
28 className={clsx(
29 'relative w-full text-left p-6 rounded-3xl transition-all duration-300 border-2 group h-full flex flex-col justify-between overflow-hidden touch-manipulation',
30 active
31 ? 'border-indigo-500 bg-white dark:bg-slate-800 shadow-xl shadow-indigo-100 dark:shadow-sky-500/5 ring-2 ring-indigo-500/20 dark:border-sky-500 dark:ring-sky-500/20'
32 : 'border-transparent bg-white/60 dark:bg-slate-900 text-slate-600 dark:text-slate-400 hover:bg-white dark:hover:bg-slate-800 hover:border-indigo-200 dark:hover:border-sky-500/30 hover:shadow-lg hover:shadow-indigo-500/5',
33 )}
34 >
35 {/* Badge */}
36 {badge && (
37 <div
38 className={clsx(
39 'absolute top-0 right-0 text-xs font-bold px-3 py-1 rounded-bl-xl transition-colors',
40 badge === 'Lossy' || badge === 'Not Recommended'
41 ? 'bg-orange-100 text-orange-700'
42 : badge === 'Privacy'
43 ? 'bg-blue-100 text-blue-700'
44 : 'bg-green-100 text-green-700',
45 )}
46 >
47 {badge}
48 </div>
49 )}
50
51 {/* Header: Icon + Checkmark */}
52 <div className="flex items-start justify-between mb-4 w-full">
53 <div
54 className={clsx(
55 'p-3.5 rounded-2xl transition-colors',
56 active
57 ? 'bg-indigo-100 text-indigo-600 dark:bg-sky-500/20 dark:text-sky-400'
58 : 'bg-slate-100 dark:bg-slate-800 text-slate-500 dark:text-slate-400 group-hover:bg-indigo-50 dark:group-hover:bg-sky-500/10 group-hover:text-indigo-600 dark:group-hover:text-sky-400',
59 )}
60 >
61 <Icon className="w-7 h-7" strokeWidth={2} />
62 </div>
63 <div
64 className={clsx(
65 'w-8 h-8 rounded-full flex items-center justify-center transition-all border-2',
66 active
67 ? 'border-indigo-500 bg-indigo-500 text-white dark:border-sky-500 dark:bg-sky-500'
68 : 'border-slate-200 dark:border-slate-700 bg-transparent',

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected