-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
47 lines (44 loc) · 1.32 KB
/
Copy pathApp.tsx
File metadata and controls
47 lines (44 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { useState } from "react";
import { Hero } from "./components/Hero";
import { NavigationButtons } from "./components/NavigationButtons";
import { data } from "./utils/helpers";
import { DarkHero } from "./components/DarkHero";
import { About } from "./components/About";
import { LightHero } from "./components/LightHero";
import { Navbar } from "./components/Navbar";
import { CTA } from "./components/CTA";
function App() {
const [sliderIndex, setSliderIndex] = useState(0);
const onNavigationHandler = (type: string) => {
if (type === "next") {
setSliderIndex((prev: number) => {
if (prev === 2) {
return 0;
}
return prev + 1;
});
} else {
setSliderIndex((prev: number) => {
if (prev === 0) return 2;
return prev - 1;
});
}
};
return (
<div className="font-Spartan w-full grid mobile-grid md:grid-cols-10 md:grid-rows-6 md:h-screen box-border">
<Navbar></Navbar>
<Hero imageIndex={sliderIndex + 1}></Hero>
<CTA
title={data[sliderIndex].title}
content={data[sliderIndex].content}
/>
<NavigationButtons
onNavigationHandler={onNavigationHandler}
></NavigationButtons>
<DarkHero></DarkHero>
<About></About>
<LightHero></LightHero>
</div>
);
}
export default App;