Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol.
wisp.place
2.3 kB
77 lines
1import { cn } from '@public/lib/utils'
2import type * as React from 'react'
3
4function Table({ className, ...props }: React.ComponentProps<'table'>) {
5 return (
6 <div data-slot="table-wrapper" className="relative w-full overflow-x-auto">
7 <table data-slot="table" className={cn('w-full caption-bottom text-sm', className)} {...props} />
8 </div>
9 )
10}
11
12function TableHeader({ className, ...props }: React.ComponentProps<'thead'>) {
13 return (
14 <thead data-slot="table-header" className={cn('[&_tr]:border-b [&_tr]:border-border/30', className)} {...props} />
15 )
16}
17
18function TableBody({ className, ...props }: React.ComponentProps<'tbody'>) {
19 return <tbody data-slot="table-body" className={cn('[&_tr:last-child]:border-0', className)} {...props} />
20}
21
22function TableFooter({ className, ...props }: React.ComponentProps<'tfoot'>) {
23 return (
24 <tfoot
25 data-slot="table-footer"
26 className={cn('border-t border-border/30 bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}
27 {...props}
28 />
29 )
30}
31
32function TableRow({ className, ...props }: React.ComponentProps<'tr'>) {
33 return (
34 <tr
35 data-slot="table-row"
36 className={cn(
37 'border-b border-border/20 transition-colors hover:bg-muted/10 data-[state=selected]:bg-muted/20',
38 className,
39 )}
40 {...props}
41 />
42 )
43}
44
45function TableHead({ className, ...props }: React.ComponentProps<'th'>) {
46 return (
47 <th
48 data-slot="table-head"
49 className={cn(
50 'h-9 px-3 text-left align-middle text-[10px] uppercase tracking-wider font-medium text-muted-foreground whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
51 className,
52 )}
53 {...props}
54 />
55 )
56}
57
58function TableCell({ className, ...props }: React.ComponentProps<'td'>) {
59 return (
60 <td
61 data-slot="table-cell"
62 className={cn(
63 'px-3 py-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
64 className,
65 )}
66 {...props}
67 />
68 )
69}
70
71function TableCaption({ className, ...props }: React.ComponentProps<'caption'>) {
72 return (
73 <caption data-slot="table-caption" className={cn('mt-4 text-xs text-muted-foreground', className)} {...props} />
74 )
75}
76
77export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow }