Sifa professional network frontend (Next.js, React, TailwindCSS) sifa.id/
at main 89 lines 2.3 kB view raw
1'use client'; 2 3import * as React from 'react'; 4 5import { cn } from '@/lib/utils'; 6 7function Table({ className, ...props }: React.ComponentProps<'table'>) { 8 return ( 9 <div data-slot="table-container" className="relative w-full overflow-x-auto"> 10 <table 11 data-slot="table" 12 className={cn('w-full caption-bottom text-sm', className)} 13 {...props} 14 /> 15 </div> 16 ); 17} 18 19function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) { 20 return <thead data-slot="table-header" className={cn('[&_tr]:border-b', className)} {...props} />; 21} 22 23function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) { 24 return ( 25 <tbody 26 data-slot="table-body" 27 className={cn('[&_tr:last-child]:border-0', className)} 28 {...props} 29 /> 30 ); 31} 32 33function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) { 34 return ( 35 <tfoot 36 data-slot="table-footer" 37 className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)} 38 {...props} 39 /> 40 ); 41} 42 43function TableRow({ className, ...props }: React.ComponentProps<'tr'>) { 44 return ( 45 <tr 46 data-slot="table-row" 47 className={cn( 48 'border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted', 49 className, 50 )} 51 {...props} 52 /> 53 ); 54} 55 56function TableHead({ className, ...props }: React.ComponentProps<'th'>) { 57 return ( 58 <th 59 data-slot="table-head" 60 className={cn( 61 'h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0', 62 className, 63 )} 64 {...props} 65 /> 66 ); 67} 68 69function TableCell({ className, ...props }: React.ComponentProps<'td'>) { 70 return ( 71 <td 72 data-slot="table-cell" 73 className={cn('p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0', className)} 74 {...props} 75 /> 76 ); 77} 78 79function TableCaption({ className, ...props }: React.ComponentProps<'caption'>) { 80 return ( 81 <caption 82 data-slot="table-caption" 83 className={cn('mt-4 text-sm text-muted-foreground', className)} 84 {...props} 85 /> 86 ); 87} 88 89export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };