Add fade-in effect to hero image on load
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
|
import { useState } from 'react'
|
||||||
import { motion } from 'framer-motion'
|
import { motion } from 'framer-motion'
|
||||||
import { ChevronDown } from 'lucide-react'
|
import { ChevronDown } from 'lucide-react'
|
||||||
|
|
||||||
@@ -8,6 +9,8 @@ interface HeroSectionProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function HeroSection({ heroPhoto }: HeroSectionProps) {
|
export default function HeroSection({ heroPhoto }: HeroSectionProps) {
|
||||||
|
const [imageLoaded, setImageLoaded] = useState(false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="relative min-h-screen flex flex-col items-center justify-center overflow-hidden">
|
<section className="relative min-h-screen flex flex-col items-center justify-center overflow-hidden">
|
||||||
{/* Background */}
|
{/* Background */}
|
||||||
@@ -16,7 +19,9 @@ export default function HeroSection({ heroPhoto }: HeroSectionProps) {
|
|||||||
<img
|
<img
|
||||||
src={`/api/files/${heroPhoto}`}
|
src={`/api/files/${heroPhoto}`}
|
||||||
alt="Maria Malejka"
|
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" />
|
<div className="absolute inset-0 bg-gradient-to-b from-black/60 via-black/40 to-black/80" />
|
||||||
{/* Grain overlay */}
|
{/* Grain overlay */}
|
||||||
|
|||||||
Reference in New Issue
Block a user