Skip to content

Commit dc150f3

Browse files
committed
3d models insertion
1 parent b9d03c1 commit dc150f3

File tree

6 files changed

+197
-21
lines changed

6 files changed

+197
-21
lines changed

package-lock.json

Lines changed: 119 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"dependencies": {
1616
"@emailjs/browser": "^4.4.1",
17+
"@google/model-viewer": "^4.1.0",
1718
"framer-motion": "^11.18.2",
1819
"lucide-react": "^0.344.0",
1920
"react": "^18.3.1",

public/assets/models/lcmf.glb

13.2 MB
Binary file not shown.

public/assets/models/totalint.glb

32.1 MB
Binary file not shown.

src/components/home/HeroSection.tsx

Lines changed: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,42 @@
1-
import React from 'react';
1+
import React, { useEffect } from 'react';
22
import { ArrowRight, PlugZap, UserPlus } from 'lucide-react';
3-
import L1Image from '../../assets/L1.webp';
43
import { scrollToContact } from '../../utils/navigation'; // no scrollToSection used anymore
54

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+
628
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+
740
const handleDemoClick = (e: React.MouseEvent) => {
841
e.preventDefault();
942
scrollToContact('demo');
@@ -55,18 +88,33 @@ const HeroSection: React.FC = () => {
5588
</div>
5689
</div>
5790

58-
{/* Right Side Card - Entirely Clickable */}
59-
<div className="relative cursor-pointer" onClick={handleCardClick}>
91+
{/* Right Side Card - Not Clickable */}
92+
<div className="relative">
6093
<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>
6194
<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+
>
70118
<h3 className="font-display font-semibold text-lg text-white mb-2">
71119
Loop Charging Module
72120
</h3>

src/components/home/TechnologySection.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useRef } from 'react';
2-
import { motion, useScroll, useTransform } from 'framer-motion';
2+
import { motion, useScroll } from 'framer-motion';
33
import { Wind, Cog, Gauge, Zap } from 'lucide-react';
4+
import '@google/model-viewer'; // Import model-viewer web component
45

56
const components = [
67
{
@@ -29,14 +30,16 @@ const components = [
2930
},
3031
];
3132

32-
const finalImage = '/assets/L2.webp';
33-
3433
const TechnologySection = () => {
3534
const sectionRef = useRef(null);
3635
const { scrollYProgress } = useScroll({ target: sectionRef, offset: ['start end', 'end start'] });
3736

3837
return (
39-
<section ref={sectionRef} className="py-32 bg-gradient-to-b from-dark-800 to-dark-900 text-white overflow-hidden">
38+
<section
39+
id="technology"
40+
ref={sectionRef}
41+
className="py-32 bg-gradient-to-b from-dark-800 to-dark-900 text-white overflow-hidden scroll-mt-[120px]"
42+
>
4043
<div className="container mx-auto px-6 lg:px-10">
4144
<motion.div
4245
initial={{ opacity: 0, y: 40 }}
@@ -89,12 +92,17 @@ const TechnologySection = () => {
8992
<p className="text-white/70 mb-6 max-w-xl mx-auto">
9093
All components combined into a single seamless energy unit that charges your EV while driving.
9194
</p>
92-
<div className="w-full max-w-3xl mx-auto rounded-2xl overflow-hidden border border-white/10 shadow-2xl">
93-
<img
94-
src={finalImage}
95+
<div className="w-full max-w-3xl mx-auto rounded-2xl overflow-hidden border border-white/10 shadow-2xl bg-black">
96+
{/* 3D Model Viewer */}
97+
<model-viewer
98+
src="/assets/models/lcmf.glb" // Replace with actual model file name
9599
alt="Final EV Assembly"
96-
className="w-full h-[400px] object-cover"
97-
loading="lazy"
100+
auto-rotate
101+
camera-controls
102+
shadow-intensity="1"
103+
exposure="1"
104+
ar
105+
style={{ width: '100%', height: '400px' }}
98106
/>
99107
</div>
100108
</motion.div>

0 commit comments

Comments
 (0)