Files
wtr/components/states/error-state.tsx
zv ee55521803
All checks were successful
CI / Lint, typecheck and build (push) Successful in 9m56s
chore: add prettier formatting
2026-06-14 20:26:56 +02:00

32 lines
949 B
TypeScript

"use client";
import { RefreshCw, TriangleAlert } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { useI18n } from "@/lib/i18n";
export function ErrorState({
title,
description,
onRetry,
}: {
title?: string;
description?: string;
onRetry: () => void;
}) {
const { t } = useI18n();
return (
<Card className="flex min-h-52 flex-col items-center justify-center p-8 text-center">
<div className="mb-4 rounded-control bg-warning/10 p-3 text-warning">
<TriangleAlert className="size-6" />
</div>
<h2 className="text-lg font-semibold">{title ?? t("error.title")}</h2>
<p className="mb-5 mt-2 max-w-md text-sm leading-6 text-muted">{description ?? t("error.description")}</p>
<Button variant="glass" onClick={onRetry}>
<RefreshCw className="size-4" />
{t("common.retry")}
</Button>
</Card>
);
}