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

Function SettingsPanel

components/SettingsPanel.tsx:21–77  ·  view source on GitHub ↗
({settings, onUpdate}: SettingsPanelProps)

Source from the content-addressed store, hash-verified

19type TabKey = 'general' | 'resize' | 'palette' | 'advanced';
20
21export const SettingsPanel = ({settings, onUpdate}: SettingsPanelProps) => {
22 const [activeTab, setActiveTab] = useState<TabKey>('general');
23
24 return (
25 <div className="bg-gradient-to-br from-blue-50 via-indigo-50 to-violet-50 dark:from-slate-900 dark:via-slate-800 dark:to-slate-900 rounded-[2.5rem] shadow-2xl shadow-indigo-100/50 dark:shadow-none border border-white dark:border-white/5 mb-10 overflow-hidden ring-1 ring-black/5 dark:ring-white/10 transition-colors duration-300">
26 {/* Tab Navigation */}
27 <div className="px-6 md:px-8 pt-8 pb-4">
28 <div className="bg-white/50 dark:bg-slate-800/50 p-1.5 rounded-3xl grid grid-cols-2 sm:flex sm:flex-wrap gap-2 sm:gap-1 shadow-sm border border-white/60 dark:border-white/5">
29 {[
30 {id: 'general', icon: Settings2, label: 'Basics'},
31 {id: 'resize', icon: Scaling, label: 'Size'},
32 {id: 'palette', icon: Palette, label: 'Colors'},
33 {id: 'advanced', icon: Sliders, label: 'Advanced'},
34 ].map(tab => (
35 <button
36 key={tab.id}
37 onClick={() => setActiveTab(tab.id as TabKey)}
38 className={clsx(
39 'flex-1 flex items-center justify-center gap-2 px-3 lg:px-5 py-4 rounded-2xl text-sm lg:text-base font-bold transition-all duration-300 ease-out whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 touch-manipulation',
40 activeTab === tab.id
41 ? 'bg-white dark:bg-slate-900 text-indigo-900 dark:text-sky-100 shadow-md shadow-indigo-100 dark:shadow-none scale-[1.02] ring-1 ring-black/5 dark:ring-white/10'
42 : 'text-slate-500 dark:text-slate-400 hover:text-indigo-700 dark:hover:text-sky-300 hover:bg-white/40 dark:hover:bg-white/5',
43 )}
44 >
45 <tab.icon
46 className={clsx(
47 'w-4 h-4 lg:w-5 lg:h-5',
48 activeTab === tab.id
49 ? 'text-indigo-500 dark:text-sky-400'
50 : 'text-slate-400 dark:text-slate-500 group-hover:text-indigo-400 dark:group-hover:text-sky-400',
51 )}
52 strokeWidth={2.5}
53 />
54 {tab.label}
55 </button>
56 ))}
57 </div>
58 </div>
59
60 {/* Tab Content Area */}
61 <div className="p-5 md:p-10 min-h-[450px]">
62 {activeTab === 'general' && (
63 <GeneralSettings settings={settings} onUpdate={onUpdate} />
64 )}
65 {activeTab === 'resize' && (
66 <ResizeSettings settings={settings} onUpdate={onUpdate} />
67 )}
68 {activeTab === 'palette' && (
69 <PaletteSettings settings={settings} onUpdate={onUpdate} />
70 )}
71 {activeTab === 'advanced' && (
72 <AdvancedSettings settings={settings} onUpdate={onUpdate} />
73 )}
74 </div>
75 </div>
76 );
77};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected