feat: add Polish and English language switcher
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
"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 = "Nie udało się pobrać danych", description = "Sprawdź połączenie i spróbuj ponownie.", onRetry }: { title?: string; description?: string; onRetry: () => void }) {
|
||||
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-full bg-amber-500/15 p-3 text-amber-700 dark:text-amber-300"><TriangleAlert className="size-6" /></div>
|
||||
<h2 className="text-lg font-semibold">{title}</h2>
|
||||
<p className="mb-5 mt-2 max-w-md text-sm leading-6 text-slate-600 dark:text-slate-300">{description}</p>
|
||||
<Button variant="glass" onClick={onRetry}><RefreshCw className="size-4" />Spróbuj ponownie</Button>
|
||||
<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-slate-600 dark:text-slate-300">{description ?? t("error.description")}</p>
|
||||
<Button variant="glass" onClick={onRetry}><RefreshCw className="size-4" />{t("common.retry")}</Button>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useI18n } from "@/lib/i18n";
|
||||
|
||||
export function LoadingSkeleton({ className = "" }: { className?: string }) {
|
||||
return <div className={cn("animate-pulse rounded-[1.75rem] bg-white/40 dark:bg-white/10", className)} aria-label="Ładowanie danych" />;
|
||||
const { t } = useI18n();
|
||||
return <div className={cn("animate-pulse rounded-[1.75rem] bg-white/40 dark:bg-white/10", className)} aria-label={t("common.loading")} />;
|
||||
}
|
||||
|
||||
export function PageLoadingSkeleton() {
|
||||
|
||||
Reference in New Issue
Block a user