refactor: extract MobileTabs shared component, replace in all 8 tools

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 16:14:56 +01:00
parent b5f698cf29
commit d476ffb613
10 changed files with 82 additions and 137 deletions

View File

@@ -2,6 +2,7 @@
import * as React from 'react';
import { SliderRow } from '@/components/ui/slider-row';
import { MobileTabs } from '@/components/ui/mobile-tabs';
import { FileUpload } from './FileUpload';
import { ConversionPreview } from './ConversionPreview';
import { toast } from 'sonner';
@@ -182,23 +183,11 @@ export function FileConverter() {
return (
<div className="flex flex-col gap-4">
{/* ── Mobile tab switcher ─────────────────────────────── */}
<div className="flex lg:hidden glass rounded-xl p-1 gap-1">
{(['upload', 'convert'] as MobileTab[]).map((t) => (
<button
key={t}
onClick={() => setMobileTab(t)}
className={cn(
'flex-1 py-2.5 rounded-lg text-sm font-medium capitalize transition-all',
mobileTab === t
? 'bg-primary text-primary-foreground shadow-sm'
: 'text-muted-foreground hover:text-foreground'
)}
>
{t === 'upload' ? 'Upload' : 'Convert'}
</button>
))}
</div>
<MobileTabs
tabs={[{ value: 'upload', label: 'Upload' }, { value: 'convert', label: 'Convert' }]}
active={mobileTab}
onChange={(v) => setMobileTab(v as MobileTab)}
/>
{/* ── Main layout ─────────────────────────────────────── */}
<div