Menyeluruh merancang ulang apps/backoffice memakai pola shadcn/ui sambil mempertahankan seluruh palette warna existing (primary/neutral/success/ info/warning/danger) dan typography Bai Jamjuree. UI library (libs/ui): - Atoms existing (Button, Input, Label, Textarea, Card, Dialog, Drawer, Form, Select, Toggle) dirombak ke pola shadcn, API dipertahankan agar sibling apps (gacha, dimentorin, hackathon, qrcampaign) tidak break - Select atom beralih dari native ke Radix Select + NativeSelect fallback - 18 atom baru: Badge, Avatar, Separator, Skeleton, Tabs, Tooltip, DropdownMenu, Popover, AlertDialog, Checkbox, RadioGroup, Switch, ScrollArea, Sheet, Sidebar, Breadcrumb, Table, + use-mobile hook - DataTable, Filter, BackofficeWrapper, Pagination, Modal (alias Dialog) direstyle dengan token baru - CSS variable layer shadcn ditambahkan (--color-primary, --color-sidebar-*, dll) dipetakan ke palette existing; tw-animate-css di-import untuk transisi Backoffice shell: - Sidebar bersarang SidebarProvider + SidebarInset, built-in mobile Sheet, user DropdownMenu (Avatar + logout), ikon lucide-react Pages redesign (19 list/dashboard/settings): - accounts, cms-events, cms-testimonials, dashboard, dashboard-dimentorin (dengan recharts di Card), feedback-review-dimentorin, gacha-roll, hackathon-dashboard, hackathon-submissions, hackathon-teams, hackathon-users, permissions, prizes, roadmap-dimentorin, roles, session-dimentorin, settings-dimentorin (Tabs), transactions, users-dimentorin (Tabs mentor/mentee) - Pola unified: BackofficeWrapper > Card (CardHeader toolbar + CardContent DataTable) + AlertDialog untuk delete confirm - Form accounts_/$id diredesign; form pages lain tetap pakai ControlledInputField yang sekarang berbasis shadcn Input Dependencies: - +20 radix-ui primitives, lucide-react, cmdk, input-otp - Select native patched di dimentorin (profile-sidebar, schedule step) untuk tetap kompatibel via NativeSelect alias Verifikasi: - nx build backoffice: sukses (2.33s, 4801 modules) - nx build dimentorin/gacha/hackathon/qrcampaign: semua sukses (zero regresi dari rewrite libs/ui) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
116 lines
2.4 KiB
TypeScript
116 lines
2.4 KiB
TypeScript
'use client';
|
|
|
|
import * as React from 'react';
|
|
import { cn } from '@imphnen-frontend-service/utils';
|
|
|
|
function Table({ className, ...props }: React.ComponentProps<'table'>) {
|
|
return (
|
|
<div
|
|
data-slot="table-container"
|
|
className="relative w-full overflow-x-auto"
|
|
>
|
|
<table
|
|
data-slot="table"
|
|
className={cn('w-full caption-bottom text-sm', className)}
|
|
{...props}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
|
|
return (
|
|
<thead
|
|
data-slot="table-header"
|
|
className={cn('[&_tr]:border-b', className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
|
|
return (
|
|
<tbody
|
|
data-slot="table-body"
|
|
className={cn('[&_tr:last-child]:border-0', className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
|
|
return (
|
|
<tfoot
|
|
data-slot="table-footer"
|
|
className={cn(
|
|
'border-t bg-neutral-50 font-medium [&>tr]:last:border-b-0',
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
|
|
return (
|
|
<tr
|
|
data-slot="table-row"
|
|
className={cn(
|
|
'border-b transition-colors hover:bg-neutral-50/60 data-[state=selected]:bg-primary-50',
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
|
|
return (
|
|
<th
|
|
data-slot="table-head"
|
|
className={cn(
|
|
'h-10 px-3 text-left align-middle text-xs font-semibold text-muted-foreground whitespace-nowrap [&:has([role=checkbox])]:pr-0',
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
|
|
return (
|
|
<td
|
|
data-slot="table-cell"
|
|
className={cn(
|
|
'p-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0',
|
|
className
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function TableCaption({
|
|
className,
|
|
...props
|
|
}: React.ComponentProps<'caption'>) {
|
|
return (
|
|
<caption
|
|
data-slot="table-caption"
|
|
className={cn('mt-4 text-sm text-muted-foreground', className)}
|
|
{...props}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export {
|
|
Table,
|
|
TableHeader,
|
|
TableBody,
|
|
TableFooter,
|
|
TableHead,
|
|
TableRow,
|
|
TableCell,
|
|
TableCaption,
|
|
};
|