empty.tsx
This file
Path
apps/web/src/components/ui/empty.tsx
100 lines · 2.3 KiB · TypeScript
Last changed by
Draw text, controls, prose and code from one set of tokensoscabrielbefore adoption60f862e
History of this fileTake it
Give the web its W9 dependencies, components, project nav, line and revision helpers, and a stub for every new pageoscabrielbefore adoption254268a
lines 1–60why, one step back1import { cva, type VariantProps } from "class-variance-authority";2import { cn } from "cn";34function Empty({ className, ...props }: React.ComponentProps<"div">) {5 return (6 <div7 data-slot="empty"8 className={cn(9 "flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-none border-dashed p-6 text-center text-balance",10 className11 )}12 {...props}13 />14 );15}1617function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) {18 return (19 <div20 data-slot="empty-header"21 className={cn("flex max-w-sm flex-col items-center gap-2", className)}22 {...props}23 />24 );25}2627const emptyMediaVariants = cva(28 "mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",29 {30 variants: {31 variant: {32 default: "bg-transparent",33 icon: "bg-muted text-foreground flex size-8 shrink-0 items-center justify-center rounded-none [&_svg:not([class*='size-'])]:size-4",34 },35 },36 defaultVariants: {37 variant: "default",38 },39 }40);4142function EmptyMedia({43 className,44 variant = "default",45 ...props46}: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>) {47 return (48 <div49 data-slot="empty-icon"50 data-variant={variant}51 className={cn(emptyMediaVariants({ variant, className }))}52 {...props}53 />54 );55}5657function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {58 return (59 <div60 data-slot="empty-title"Draw text, controls, prose and code from one set of tokensoscabrielbefore adoption60f862e
line 61why, one step back61 className={cn("text-want font-semibold", className)}Give the web its W9 dependencies, components, project nav, line and revision helpers, and a stub for every new pageoscabrielbefore adoption254268a
lines 62–71why, one step back62 {...props}63 />64 );65}6667function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {68 return (69 <div70 data-slot="empty-description"71 className={cn(Draw text, controls, prose and code from one set of tokensoscabrielbefore adoption60f862e
line 72why, one step back72 "text-muted-foreground [&>a:hover]:text-primary text-ui [&>a]:underline [&>a]:underline-offset-4",Give the web its W9 dependencies, components, project nav, line and revision helpers, and a stub for every new pageoscabrielbefore adoption254268a
lines 73–84why, one step back73 className74 )}75 {...props}76 />77 );78}7980function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {81 return (82 <div83 data-slot="empty-content"84 className={cn(Draw text, controls, prose and code from one set of tokensoscabrielbefore adoption60f862e
line 85why, one step back85 "text-ui flex w-full max-w-sm min-w-0 flex-col items-center gap-2.5 text-balance",Give the web its W9 dependencies, components, project nav, line and revision helpers, and a stub for every new pageoscabrielbefore adoption254268a
lines 86–100why, one step back86 className87 )}88 {...props}89 />90 );91}9293export {94 Empty,95 EmptyHeader,96 EmptyTitle,97 EmptyDescription,98 EmptyContent,99 EmptyMedia,100};