Files
portabase/src/components/wrappers/auth/auth-logo-section.tsx
T

47 lines
1.1 KiB
TypeScript
Raw Normal View History

"use client";
2025-11-04 08:48:46 +01:00
import {env} from "@/env.mjs";
import {useTheme} from "next-themes";
import Image from "next/image";
import {useEffect, useState} from "react";
2025-11-04 08:48:46 +01:00
export const AuthLogoSection = () => {
const {resolvedTheme} = useTheme();
const [mounted, setMounted] = useState(false);
2025-12-22 14:23:52 +01:00
const [loaded, setLoaded] = useState(false);
2025-11-04 08:48:46 +01:00
useEffect(() => {
setMounted(true);
}, []);
const imageTheme =
resolvedTheme === "dark"
2025-12-23 22:06:14 +01:00
? "/images/logo-dark.png"
: "/images/logo-light.png";
2025-11-04 08:48:46 +01:00
2025-12-22 14:23:52 +01:00
const handleLoad = () => setLoaded(true);
const style = {
transition: "opacity 0.3s ease-in-out",
opacity: loaded ? 1 : 0,
};
2025-11-04 08:48:46 +01:00
return (
<div className="sm:mx-auto sm:w-full sm:max-w-md relative flex items-center justify-center h-[160px]">
{mounted && (
<Image
src={imageTheme}
alt="Logo"
fill
priority
className="object-contain p-10"
2025-12-22 14:23:52 +01:00
onLoad={handleLoad}
style={style}
/>
)}
2025-11-04 08:48:46 +01:00
</div>
);
};