|
1 | | -import React from 'react'; |
| 1 | +import React, { useEffect } from 'react'; |
2 | 2 | import { ArrowRight, PlugZap, UserPlus } from 'lucide-react'; |
3 | | -import L1Image from '../../assets/L1.webp'; |
4 | 3 | import { scrollToContact } from '../../utils/navigation'; // no scrollToSection used anymore |
5 | 4 |
|
| 5 | +// TypeScript declaration for model-viewer |
| 6 | +// (If you have a global types file, move this there) |
| 7 | +declare global { |
| 8 | + namespace JSX { |
| 9 | + interface IntrinsicElements { |
| 10 | + 'model-viewer': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & { |
| 11 | + src: string; |
| 12 | + alt?: string; |
| 13 | + 'camera-controls'?: boolean; |
| 14 | + 'auto-rotate'?: boolean; |
| 15 | + 'shadow-intensity'?: string | number; |
| 16 | + exposure?: string | number; |
| 17 | + 'environment-image'?: string; |
| 18 | + ar?: boolean; |
| 19 | + 'ar-modes'?: string; |
| 20 | + loading?: string; |
| 21 | + 'disable-zoom'?: boolean | string; |
| 22 | + style?: React.CSSProperties; |
| 23 | + }; |
| 24 | + } |
| 25 | + } |
| 26 | +} |
| 27 | + |
6 | 28 | const HeroSection: React.FC = () => { |
| 29 | + useEffect(() => { |
| 30 | + // Dynamically load model-viewer script if not already present |
| 31 | + if (!document.querySelector('script[src*="model-viewer.min.js"]')) { |
| 32 | + const script = document.createElement('script'); |
| 33 | + script.type = 'module'; |
| 34 | + script.src = 'https://unpkg.com/@google/model-viewer@^3.4.0/dist/model-viewer.min.js'; |
| 35 | + script.async = true; |
| 36 | + document.head.appendChild(script); |
| 37 | + } |
| 38 | + }, []); |
| 39 | + |
7 | 40 | const handleDemoClick = (e: React.MouseEvent) => { |
8 | 41 | e.preventDefault(); |
9 | 42 | scrollToContact('demo'); |
@@ -55,18 +88,33 @@ const HeroSection: React.FC = () => { |
55 | 88 | </div> |
56 | 89 | </div> |
57 | 90 |
|
58 | | - {/* Right Side Card - Entirely Clickable */} |
59 | | - <div className="relative cursor-pointer" onClick={handleCardClick}> |
| 91 | + {/* Right Side Card - Not Clickable */} |
| 92 | + <div className="relative"> |
60 | 93 | <div className="absolute inset-0 bg-gradient-to-r from-primary-500/20 to-secondary-500/20 rounded-2xl blur-xl pointer-events-none"></div> |
61 | 94 | <div className="relative bg-dark-800/80 backdrop-blur-sm border border-white/10 rounded-2xl p-6 shadow-xl animate-float hover:scale-[1.02] transition-transform duration-300"> |
62 | | - <img |
63 | | - src={L1Image} |
64 | | - alt="LCM Technology Render" |
65 | | - className="w-full h-auto rounded-lg mb-4 pointer-events-none" |
66 | | - loading="eager" |
67 | | - draggable="false" |
68 | | - /> |
69 | | - <div className="bg-dark-900/50 backdrop-blur-sm rounded-lg p-4 border border-white/10 pointer-events-none"> |
| 95 | + {/* 3D Model Viewer as static */} |
| 96 | + <model-viewer |
| 97 | + src="/assets/models/totalint.glb" |
| 98 | + alt="LCM Technology 3D Model" |
| 99 | + style={{ width: '100%', height: '340px', background: 'transparent', borderRadius: '12px' }} |
| 100 | + camera-controls |
| 101 | + auto-rotate |
| 102 | + shadow-intensity="1" |
| 103 | + exposure="1" |
| 104 | + environment-image="neutral" |
| 105 | + ar |
| 106 | + ar-modes="webxr scene-viewer quick-look" |
| 107 | + loading="lazy" |
| 108 | + disable-zoom={false} |
| 109 | + ></model-viewer> |
| 110 | + <div |
| 111 | + className="bg-dark-900/50 backdrop-blur-sm rounded-lg p-4 border border-white/10 cursor-pointer" |
| 112 | + onClick={handleCardClick} |
| 113 | + tabIndex={0} |
| 114 | + role="button" |
| 115 | + aria-label="Learn more about the Loop Charging Module" |
| 116 | + style={{ outline: 'none' }} |
| 117 | + > |
70 | 118 | <h3 className="font-display font-semibold text-lg text-white mb-2"> |
71 | 119 | Loop Charging Module |
72 | 120 | </h3> |
|
0 commit comments