"use client"; import { usePathname } from "next/navigation"; import { useTheme } from "next-themes"; import { useEffect, useState, type CSSProperties } from "react"; import { Toaster as Sonner, type ToasterProps } from "sonner"; import { cn } from "@/lib/utils"; export function Toaster(props: ToasterProps) { const pathname = usePathname(); const { resolvedTheme = "light" } = useTheme(); const [documentLang, setDocumentLang] = useState("de"); useEffect(() => { setDocumentLang(document.documentElement.lang || "de"); }, [pathname]); const isArabic = documentLang === "ar"; const toastFontClassName = isArabic ? "font-arabic text-right tracking-normal" : "font-latin text-left"; const toasterStyle: CSSProperties & Record<"--width", string> = { "--width": "max-content", left: "50%", right: "auto", transform: "translateX(-50%)", ...(props.style ?? {}), }; return ( ); }