forked from git.gladyson/openmonetis
refactor: reorganiza componentes compartilhados e caminhos do app
This commit is contained in:
53
components/shared/empty-state.tsx
Normal file
53
components/shared/empty-state.tsx
Normal file
@@ -0,0 +1,53 @@
|
||||
import type { ReactNode } from "react";
|
||||
import {
|
||||
Empty,
|
||||
EmptyContent,
|
||||
EmptyDescription,
|
||||
EmptyHeader,
|
||||
EmptyMedia,
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { cn } from "@/lib/utils/ui";
|
||||
|
||||
interface EmptyStateProps {
|
||||
title: ReactNode;
|
||||
description?: ReactNode;
|
||||
action?: ReactNode;
|
||||
media?: ReactNode;
|
||||
mediaVariant?: "default" | "icon";
|
||||
className?: string;
|
||||
contentClassName?: string;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export function EmptyState({
|
||||
title,
|
||||
description,
|
||||
media,
|
||||
mediaVariant = "default",
|
||||
className,
|
||||
contentClassName,
|
||||
children,
|
||||
}: EmptyStateProps) {
|
||||
const hasContent = Boolean(children);
|
||||
|
||||
return (
|
||||
<Empty className={cn("w-full max-w-xl min-h-[320px]", className)}>
|
||||
<EmptyHeader>
|
||||
{media ? (
|
||||
<EmptyMedia variant={mediaVariant} className="mb-0">
|
||||
{media}
|
||||
</EmptyMedia>
|
||||
) : null}
|
||||
<EmptyTitle>{title}</EmptyTitle>
|
||||
{description ? (
|
||||
<EmptyDescription>{description}</EmptyDescription>
|
||||
) : null}
|
||||
</EmptyHeader>
|
||||
|
||||
{hasContent ? (
|
||||
<EmptyContent className={cn(contentClassName)}>{children}</EmptyContent>
|
||||
) : null}
|
||||
</Empty>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user