Compare commits
4 Commits
version_2_
...
version_4_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8915a2817 | ||
| 3aa9469b5d | |||
|
|
c9c7285f53 | ||
| eed444b7ad |
@@ -12,6 +12,9 @@ import TeamSection from './HomePage/sections/Team';
|
|||||||
import TestimonialsSection from './HomePage/sections/Testimonials';
|
import TestimonialsSection from './HomePage/sections/Testimonials';
|
||||||
import ContactSection from './HomePage/sections/Contact';
|
import ContactSection from './HomePage/sections/Contact';
|
||||||
|
|
||||||
|
|
||||||
|
{/* webild-stub @2026-06-03T14:26:17.945Z: Make the hero section smoothly switch between 4 images, with a loading animation in between each image transition. */}
|
||||||
|
|
||||||
export default function HomePage(): React.JSX.Element {
|
export default function HomePage(): React.JSX.Element {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -16,53 +16,89 @@ const IMAGES = [
|
|||||||
|
|
||||||
export default function HeroSection(): React.JSX.Element {
|
export default function HeroSection(): React.JSX.Element {
|
||||||
const [currentImageIndex, setCurrentImageIndex] = useState(0);
|
const [currentImageIndex, setCurrentImageIndex] = useState(0);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [progress, setProgress] = useState(0);
|
||||||
const [currentImage, setCurrentImage] = useState(IMAGES[0]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const interval = setInterval(() => {
|
const duration = 5000; // 5 seconds per image
|
||||||
setIsLoading(true);
|
const interval = 50; // update progress every 50ms
|
||||||
setCurrentImageIndex((prevIndex) => (prevIndex + 1) % IMAGES.length);
|
const step = (interval / duration) * 100;
|
||||||
}, 5000); // Change image every 5 seconds
|
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
const timer = setInterval(() => {
|
||||||
|
setProgress((prev) => {
|
||||||
|
if (prev >= 100) {
|
||||||
|
setCurrentImageIndex((prevIndex) => (prevIndex + 1) % IMAGES.length);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return prev + step;
|
||||||
|
});
|
||||||
|
}, interval);
|
||||||
|
|
||||||
|
return () => clearInterval(timer);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const image = new Image();
|
|
||||||
image.src = IMAGES[currentImageIndex];
|
|
||||||
image.onload = () => {
|
|
||||||
setCurrentImage(IMAGES[currentImageIndex]);
|
|
||||||
setIsLoading(false);
|
|
||||||
};
|
|
||||||
image.onerror = () => {
|
|
||||||
console.error("Failed to load image:", IMAGES[currentImageIndex]);
|
|
||||||
setIsLoading(false);
|
|
||||||
};
|
|
||||||
}, [currentImageIndex]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="hero" data-section="hero" className="relative">
|
<div id="hero" data-webild-section="hero" className="relative w-full pt-24 pb-12 px-6">
|
||||||
{isLoading && (
|
<div className="max-w-6xl mx-auto mb-12">
|
||||||
<div className="absolute inset-0 flex items-center justify-center bg-background/80 z-10">
|
<h1 className="text-6xl md:text-8xl font-bold tracking-tight mb-8 text-center">
|
||||||
<div className="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-foreground"></div>
|
Innovate Marketing
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div className="flex flex-col md:flex-row justify-end items-end gap-6">
|
||||||
|
<div className="max-w-md text-right">
|
||||||
|
<p className="text-base md:text-lg text-muted-foreground mb-6">
|
||||||
|
Your Vision, Amplified. We craft data-driven strategies and compelling narratives to elevate your brand and drive measurable results. Let's grow together.
|
||||||
|
</p>
|
||||||
|
<div className="flex items-center justify-end gap-4">
|
||||||
|
<a href="#services" className="inline-flex items-center justify-center h-10 px-4 py-2 bg-primary text-primary-foreground hover:bg-primary/90 rounded-full font-medium transition-colors">
|
||||||
|
Our Services
|
||||||
|
</a>
|
||||||
|
<a href="#contact" className="inline-flex items-center justify-center h-10 px-4 py-2 bg-secondary text-secondary-foreground hover:bg-secondary/80 rounded-full font-medium transition-colors">
|
||||||
|
Contact Us
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
<SectionErrorBoundary name="hero">
|
|
||||||
<HeroBillboardBrand
|
|
||||||
brand="Innovate Marketing"
|
|
||||||
description="Your Vision, Amplified. We craft data-driven strategies and compelling narratives to elevate your brand and drive measurable results. Let's grow together."
|
|
||||||
primaryButton={{
|
|
||||||
text: "Our Services",
|
|
||||||
href: "#services",
|
|
||||||
}}
|
|
||||||
secondaryButton={{
|
|
||||||
text: "Contact Us",
|
|
||||||
href: "#contact",
|
|
||||||
}}
|
|
||||||
imageSrc={currentImage}
|
|
||||||
/>
|
|
||||||
</SectionErrorBoundary>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full max-w-6xl mx-auto relative rounded-3xl overflow-hidden aspect-[16/9] md:aspect-[21/9] shadow-2xl bg-muted">
|
||||||
|
{IMAGES.map((src, index) => (
|
||||||
|
<div
|
||||||
|
key={src}
|
||||||
|
className={`absolute inset-0 transition-opacity duration-1000 ease-in-out ${
|
||||||
|
index === currentImageIndex ? 'opacity-100 z-10' : 'opacity-0 z-0'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={src}
|
||||||
|
alt={`Slide ${index + 1}`}
|
||||||
|
className="w-full h-full object-cover"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{/* Progress Bars Overlay */}
|
||||||
|
<div className="absolute bottom-6 left-0 right-0 z-20 flex justify-center gap-3 px-6">
|
||||||
|
{IMAGES.map((_, index) => (
|
||||||
|
<div
|
||||||
|
key={index}
|
||||||
|
className="h-1.5 w-16 sm:w-24 bg-white/30 rounded-full overflow-hidden backdrop-blur-sm cursor-pointer"
|
||||||
|
onClick={() => {
|
||||||
|
setCurrentImageIndex(index);
|
||||||
|
setProgress(0);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="h-full bg-white transition-all duration-75 ease-linear"
|
||||||
|
style={{
|
||||||
|
width: index === currentImageIndex
|
||||||
|
? `${progress}%`
|
||||||
|
: index < currentImageIndex ? '100%' : '0%'
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user