Add fade-in effect to hero image on load

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
denshooter
2026-02-19 21:39:29 +01:00
parent b14166d826
commit 5fce4cd1c6
+6 -1
View File
@@ -1,5 +1,6 @@
'use client'
import { useState } from 'react'
import { motion } from 'framer-motion'
import { ChevronDown } from 'lucide-react'
@@ -8,6 +9,8 @@ interface HeroSectionProps {
}
export default function HeroSection({ heroPhoto }: HeroSectionProps) {
const [imageLoaded, setImageLoaded] = useState(false)
return (
<section className="relative min-h-screen flex flex-col items-center justify-center overflow-hidden">
{/* Background */}
@@ -16,7 +19,9 @@ export default function HeroSection({ heroPhoto }: HeroSectionProps) {
<img
src={`/api/files/${heroPhoto}`}
alt="Maria Malejka"
className="w-full h-full object-cover"
className="w-full h-full object-cover transition-opacity duration-1000 ease-in-out"
style={{ opacity: imageLoaded ? 1 : 0 }}
onLoad={() => setImageLoaded(true)}
/>
<div className="absolute inset-0 bg-gradient-to-b from-black/60 via-black/40 to-black/80" />
{/* Grain overlay */}