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:
@@ -14,6 +14,7 @@ import {
|
||||
type ConversionResult,
|
||||
} from '@/lib/units/units';
|
||||
import { parseNumberInput, formatNumber, cn } from '@/lib/utils';
|
||||
import { MobileTabs } from '@/components/ui/mobile-tabs';
|
||||
|
||||
type Tab = 'category' | 'convert';
|
||||
|
||||
@@ -87,23 +88,11 @@ export default function MainConverter() {
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
|
||||
{/* ── Mobile tab switcher ────────────────────────────────── */}
|
||||
<div className="flex lg:hidden glass rounded-xl p-1 gap-1">
|
||||
{(['category', 'convert'] as Tab[]).map((t) => (
|
||||
<button
|
||||
key={t}
|
||||
onClick={() => setTab(t)}
|
||||
className={cn(
|
||||
'flex-1 py-2.5 rounded-lg text-sm font-medium capitalize transition-all',
|
||||
tab === t
|
||||
? 'bg-primary text-primary-foreground shadow-sm'
|
||||
: 'text-muted-foreground hover:text-foreground'
|
||||
)}
|
||||
>
|
||||
{t === 'category' ? 'Category' : 'Convert'}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<MobileTabs
|
||||
tabs={[{ value: 'category', label: 'Category' }, { value: 'convert', label: 'Convert' }]}
|
||||
active={tab}
|
||||
onChange={(v) => setTab(v as Tab)}
|
||||
/>
|
||||
|
||||
{/* ── Main layout ────────────────────────────────────────── */}
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user