diff --git a/src/components/HeroSection.tsx b/src/components/HeroSection.tsx
index a65330f..b90bb92 100644
--- a/src/components/HeroSection.tsx
+++ b/src/components/HeroSection.tsx
@@ -2,7 +2,8 @@ import React, { useState, useEffect, useCallback } from 'react';
import { ChevronLeft, ChevronRight } from 'lucide-react';
import { navigateTo } from './Router';
import svgPaths from "../imports/svg-i1joeov37f";
-
+import PrimaryCTAButton from './PrimaryCTAButton';
+
interface SlideData {
id: number;
title: string;
@@ -11,12 +12,12 @@ interface SlideData {
ctaText: string;
route: string;
}
-
+
export default function HeroSection() {
const [currentSlide, setCurrentSlide] = useState(0);
const [isAutoPlaying, setIsAutoPlaying] = useState(true);
const [progressValues, setProgressValues] = useState([0, 0, 0, 0, 0, 0]);
-
+
const slides: SlideData[] = [
{
id: 1,
@@ -32,7 +33,7 @@ export default function HeroSection() {
backgroundImage: "https://images.unsplash.com/photo-1705234384669-c6d31c61b789?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3w3Nzg4Nzd8MHwxfHNlYXJjaHwxfHxleGVjdXRpdmUlMjBsZWFkZXJzaGlwJTIwZGV2ZWxvcG1lbnQlMjB0cmFpbmluZ3xlbnwxfHx8fDE3NTY4MDcyNjJ8MA&ixlib=rb-4.1.0&q=80&w=1080&utm_source=figma&utm_medium=referral",
shortTitle: "Leadership Development",
ctaText: "Explore Leadership Journeys",
- route: '/services/leadership-development'
+ route: '/services/leadership-development'
},
{
id: 3,
@@ -67,25 +68,25 @@ export default function HeroSection() {
route: '/services/learning-facility'
}
];
-
+
const totalSlides = slides.length;
const slideDuration = 5000; // 5 seconds per slide
-
+
// Auto-advance slides
useEffect(() => {
if (!isAutoPlaying) return;
-
+
const interval = setInterval(() => {
setCurrentSlide((prev) => (prev + 1) % totalSlides);
}, slideDuration);
-
+
return () => clearInterval(interval);
}, [isAutoPlaying, totalSlides]);
-
+
// Progress bar animation
useEffect(() => {
if (!isAutoPlaying) return;
-
+
const interval = setInterval(() => {
setProgressValues(prev => {
const newProgress = [...prev];
@@ -103,10 +104,10 @@ export default function HeroSection() {
return newProgress;
});
}, 100);
-
+
return () => clearInterval(interval);
}, [currentSlide, isAutoPlaying]);
-
+
// Reset progress when manually changing slides
useEffect(() => {
setProgressValues(prev => {
@@ -115,7 +116,7 @@ export default function HeroSection() {
return newProgress;
});
}, [currentSlide]);
-
+
const goToSlide = useCallback((slideIndex: number) => {
if (slideIndex !== currentSlide) {
setCurrentSlide(slideIndex);
@@ -124,23 +125,23 @@ export default function HeroSection() {
setTimeout(() => setIsAutoPlaying(true), 3000);
}
}, [currentSlide]);
-
+
const nextSlide = useCallback(() => {
const next = (currentSlide + 1) % totalSlides;
goToSlide(next);
}, [currentSlide, totalSlides, goToSlide]);
-
+
const prevSlide = useCallback(() => {
const prev = (currentSlide - 1 + totalSlides) % totalSlides;
goToSlide(prev);
}, [currentSlide, totalSlides, goToSlide]);
-
+
// Pause auto-play on hover
const handleMouseEnter = () => setIsAutoPlaying(false);
const handleMouseLeave = () => setIsAutoPlaying(true);
-
+
return (
-
))}
-
+
{/* Hero Content */}
@@ -167,144 +168,54 @@ export default function HeroSection() {
{/* Dynamic CTA Button - Enhanced with Proper Navigation */}
-
{
- console.log('Hero button clicked - navigating to contact page');
- navigateTo(slides[currentSlide].route);
- }}
- aria-label={slides[currentSlide].ctaText}
- >
- {/* Icon Container with Slide Animation */}
-
- {/* Background Rectangle - Consistent Blue Color */}
-
-
- {/* Icon Layer - Sliding Animation */}
-
- {/* Primary Arrow - Slides out diagonally up-right */}
-
-
- {/* Secondary Arrow - Slides in from bottom-left */}
-
-
-
- {/* Text Section with Vertical Slide Animation */}
-
- {/* Primary Text - Slides up and out */}
-
- {slides[currentSlide].ctaText}
-
-
- {/* Secondary Text - Slides in from bottom */}
-
- {slides[currentSlide].ctaText}
-
-
-
+
navigateTo(slides[currentSlide].route)}
+ ariaLabel="Learn more about KLC"
+ />
-
+
+
{/* Bottom Navigation */}
{/* Progress Section */}
{slides.map((slide, index) => (
-
goToSlide(index)}
>
{/* Progress Bar */}
-
navigateTo(slide.route)}
>
-
-
+ {/* Progress Bar */}
+
- {/* Progress Number */}
-
- {String(index + 1).padStart(2, '0')}
-
+ {/* Progress Number */}
+
+ {String(index + 1).padStart(2, '0')}
+
- {/* Progress Text */}
-
- {slide.shortTitle}
+ {/* Progress Text */}
+
+ {slide.shortTitle}
+
))}
-
+
{/* Navigation Arrows */}
) => void;
- className?: string;
+ onClick: () => void;
ariaLabel?: string;
- debugId?: string; // Add debug identifier
+ className?: string;
+ disabled?: boolean;
}
-export const PrimaryCTAButton: React.FC = ({
- text,
- onClick,
+export function PrimaryCTAButton({
+ text,
+ onClick,
+ ariaLabel,
className = '',
- ariaLabel,
- debugId = 'unknown'
-}) => {
- // Debug: Log when component mounts
- useEffect(() => {
- console.log(`PrimaryCTAButton ${debugId} mounted`);
- }, [debugId]);
-
- const handleClick = (e: React.MouseEvent) => {
- e.preventDefault();
- console.log(`Primary CTA Button ${debugId} clicked with text: "${text}"`); // Debug log
- // Handle webinars navigation
- if (text === "Join Our Webinars" || text === "Explore Webinars" || text === "View Webinars") {
- console.log(`Navigating to webinars page for ${debugId}`);
- navigateTo('/webinars');
- } else if (text === "Register Free" || text === "Watch Replay" || text === "Launch in Zoom") {
- // These are handled by individual webinar detail pages
- console.log(`Webinar CTA handled by detail page for ${debugId}`);
- } else if (onClick) {
- console.log(`Custom onClick handler found for ${debugId}, executing it`); // Debug log
- onClick(e);
- } else {
- console.log(`No custom onClick for ${debugId}, navigating to webcast page`); // Debug log
- // Navigate to webcast page by default
- navigateTo('/learning/webcast');
- }
- };
+ disabled = false
+}: PrimaryCTAButtonProps) {
+ const [isHovered, setIsHovered] = useState(false);
return (
- setIsHovered(true)}
+ onMouseLeave={() => setIsHovered(false)}
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ gap: '12px',
+ padding: '8px 20px',
+ borderRadius: '10px',
+ border: 'none',
+ cursor: disabled ? 'not-allowed' : 'pointer',
+ fontSize: 'var(--font-body-lg)',
+ fontWeight: 'var(--font-weight-h3)',
+ fontFamily: 'var(--font-family-base)',
+ backgroundColor: disabled ? '#9CA3AF' : 'var(--color-primary)',
+ color: '#FFFFFF',
+ boxShadow: disabled
+ ? 'none'
+ : '0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)',
+ transition: 'all 300ms ease-in-out',
+ position: 'relative',
+ overflow: 'hidden',
+ opacity: disabled ? 0.6 : 1,
+ transform: isHovered && !disabled ? 'translateY(-2px)' : 'translateY(0)',
+ ...(isHovered && !disabled && {
+ backgroundColor: '#030359', // Darker shade of primary brand color
+ boxShadow: '0 8px 25px rgba(4, 4, 91, 0.3), 0 4px 6px rgba(4, 4, 91, 0.1)'
+ })
+ }}
+ >
+ {/* Text */}
+
- {/* Icon Container with Slide Animation */}
-
- {/* Background Rectangle - Consistent Yellow Color */}
-
-
- {/* Icon Layer - Sliding Animation */}
-
- {/* Primary Arrow - Slides out diagonally up-right */}
-
-
- {/* Secondary Arrow - Slides in from bottom-left */}
-
-
-
-
- {/* Text Section with Vertical Slide Animation */}
-
- {/* Primary Text - Slides up and out */}
-
- {text}
-
-
- {/* Secondary Text - Slides in from bottom */}
-
- {text}
-
-
-
+ {text}
+
+
+ {/* Arrow icon with enhanced animation */}
+
+
+
+
);
-};
\ No newline at end of file
+}
+
+// Named exports for backward compatibility
+export const PrimaryCTAButtonProps = PrimaryCTAButton;
+export default PrimaryCTAButton;
\ No newline at end of file