perf(hero): remove artificial JS fade-in delay for LCP image
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import React, { useState } from 'react'
|
||||
import React from 'react'
|
||||
import { motion } from 'framer-motion'
|
||||
import type { Page, Media } from '../../payload-types'
|
||||
import Link from 'next/link'
|
||||
@@ -43,7 +43,6 @@ export const HeroBlock: React.FC<Props> = ({
|
||||
floatingStat,
|
||||
whatsappNumber,
|
||||
}) => {
|
||||
const [imageLoaded, setImageLoaded] = useState(false)
|
||||
const whatsappLink = whatsappNumber ? `https://wa.me/${whatsappNumber}` : '#'
|
||||
|
||||
const heroMedia = typeof image === 'object' && image !== null ? (image as Media) : null
|
||||
@@ -69,10 +68,7 @@ export const HeroBlock: React.FC<Props> = ({
|
||||
fill
|
||||
priority
|
||||
sizes="100vw"
|
||||
onLoad={() => setImageLoaded(true)}
|
||||
className={`object-cover object-center transition-all duration-1000 ${
|
||||
imageLoaded ? 'opacity-100 scale-100' : 'opacity-0 scale-105'
|
||||
}`}
|
||||
className="object-cover object-center"
|
||||
/>
|
||||
{/* Ciemny gradient pod spodem, by biały tekst był świetnie czytelny, a zdjęcie pozostało nasycone */}
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/80 via-black/40 to-transparent lg:bg-gradient-to-r lg:from-black/90 lg:via-black/40 lg:to-transparent" />
|
||||
|
||||
Reference in New Issue
Block a user