components/linyi/empty-state.tsx
class-variance-authority
"use client"; import * as React from "react";import { cva, type VariantProps } from "class-variance-authority";import { cn } from "@/lib/cn"; export const emptyStateVariants = cva( "flex w-full flex-col items-center justify-center text-center", { variants: { variant: { surface: "rounded-panel border border-line bg-surface", well: "rounded-panel border border-dashed border-line-strong bg-well/60", plain: "bg-transparent", }, size: { sm: "px-4 py-6 gap-2", md: "px-6 py-10 gap-2.5", lg: "px-8 py-14 gap-3", }, }, defaultVariants: { variant: "well", size: "md", }, }); export interface EmptyStateProps extends React.ComponentPropsWithRef<"div">, VariantProps<typeof emptyStateVariants> {} export function EmptyState({ className, variant = "well", size = "md", ...props}: EmptyStateProps) { return ( <div className={cn(emptyStateVariants({ variant, size }), className)} {...props} /> );} export function EmptyStateIcon({ className, ...props}: React.ComponentPropsWithRef<"div">) { return ( <div aria-hidden="true" className={cn( "mb-1 inline-flex size-10 items-center justify-center rounded-well border border-line bg-surface text-fg-secondary", className )} {...props} /> );} export function EmptyStateTitle({ className, ...props}: React.ComponentPropsWithRef<"h3">) { return ( <h3 className={cn("text-sm font-semibold tracking-tight text-fg", className)} {...props} /> );} export function EmptyStateDescription({ className, ...props}: React.ComponentPropsWithRef<"p">) { return ( <p className={cn("max-w-xs text-xs leading-relaxed text-fg-secondary", className)} {...props} /> );} export function EmptyStateActions({ className, ...props}: React.ComponentPropsWithRef<"div">) { return ( <div className={cn("mt-2 flex flex-wrap items-center justify-center gap-2", className)} {...props} /> );}