Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/llms-txt-hub / apps/web/components/empty-state.tsx |
| Date | Not specified in source |
| Repository | Janady13/llms-txt-hub |
| Revision | e0f4bf978d4df168369c7601d9c5f5ea89e84377 |
| Branch | main |
| Path or archive member | apps/web/components/empty-state.tsx |
| Original SHA-256 | c8a133212ee2bb3c72acc3bd404bcce5483791373e42d9e1665261cee384b2e7 |
| Git blob SHA | 90b9ac72674888efa097ba76a4b6483d1710d4ff |
| Reading-copy SHA-256 | c8a133212ee2bb3c72acc3bd404bcce5483791373e42d9e1665261cee384b2e7 |
Recovered source transcript
Download complete source text ↓70 lines · 2.3 KB
import { Button } from '@thedaviddias/design-system/button'
import { cn } from '@thedaviddias/design-system/lib/utils'
import { FolderOpen, type LucideIcon } from 'lucide-react'
import Link from 'next/link'
interface EmptyStateProps {
title: string
description: string
actionLabel?: string
actionHref?: string
onAction?: () => void
icon?: LucideIcon
iconClassName?: string
iconContainerClassName?: string
className?: string
titleClassName?: string
descriptionClassName?: string
}
/**
* Display an empty state with optional action button
* @param props - Component props
* @param props.title - The title to display
* @param props.description - The description text
* @param props.actionLabel - Optional label for the action button
* @param props.actionHref - Optional href for link-based action
* @param props.onAction - Optional click handler for button action
* @param props.icon - Optional custom icon component
* @param props.iconClassName - Optional className for the icon
* @param props.iconContainerClassName - Optional className for the icon container
* @param props.className - Optional className for the container
* @param props.titleClassName - Optional className for the title
* @param props.descriptionClassName - Optional className for the description
* @returns React component
*/
export function EmptyState({
title,
description,
actionLabel,
actionHref,
onAction,
icon: Icon = FolderOpen,
iconClassName,
iconContainerClassName,
className,
titleClassName,
descriptionClassName
}: EmptyStateProps) {
return (
<div
className={cn('flex flex-col items-center justify-center h-[50vh] text-center', className)}
>
<div className={iconContainerClassName}>
<Icon className={cn('h-16 w-16 text-muted-foreground mb-4', iconClassName)} />
</div>
<h2 className={cn('text-2xl font-bold mb-2', titleClassName)}>{title}</h2>
<p className={cn('text-muted-foreground mb-4 max-w-md', descriptionClassName)}>
{description}
</p>
{onAction && actionLabel ? (
<Button onClick={onAction}>{actionLabel}</Button>
) : actionHref && actionLabel ? (
<Button asChild>
<Link href={actionHref}>{actionLabel}</Link>
</Button>
) : null}
</div>
)
}