|
1 | 1 | import * as React from 'react'; |
2 | | -import { useState } from 'react'; |
3 | | -import { |
4 | | - FullpageContainer, |
5 | | - FullpageSection, |
6 | | -} from '@shinyongjun/react-fullpage'; |
7 | | -import FirstSection from './components/FirstSection'; |
8 | | -import FooterSection from './components/FooterSection'; |
9 | | -import SecondSection from './components/SecondSection'; |
10 | | -import ThirdSection from './components/ThirdSection'; |
| 2 | +import { Route, Routes } from 'react-router-dom'; |
| 3 | +import Home from './routes/home'; |
| 4 | +import Fullpage from './routes/fullpage'; |
11 | 5 |
|
12 | 6 | function App() { |
13 | | - const [activeIndex, setActiveIndex] = useState<number>(2); |
14 | | - |
15 | 7 | return ( |
16 | | - <> |
17 | | - <FullpageContainer |
18 | | - transitionDuration={700} |
19 | | - activeIndex={activeIndex} |
20 | | - setActiveIndex={setActiveIndex} |
21 | | - onBeforeChange={(beforeIndex, afterIndex) => { |
22 | | - console.log('before', beforeIndex, afterIndex); |
23 | | - }} |
24 | | - onAfterChange={(beforeIndex, afterIndex) => { |
25 | | - console.log('after', beforeIndex, afterIndex); |
26 | | - }} |
27 | | - onAfterLoad={(container) => { |
28 | | - console.log('afterLoad', container); |
29 | | - }} |
30 | | - > |
31 | | - <FullpageSection name="first"> |
32 | | - <FirstSection /> |
33 | | - </FullpageSection> |
34 | | - <FullpageSection name="second"> |
35 | | - <SecondSection /> |
36 | | - </FullpageSection> |
37 | | - <FullpageSection name="third"> |
38 | | - <ThirdSection /> |
39 | | - </FullpageSection> |
40 | | - <FullpageSection name="footer" isAutoHeight> |
41 | | - <FooterSection /> |
42 | | - </FullpageSection> |
43 | | - </FullpageContainer> |
44 | | - <div |
45 | | - className="controller" |
46 | | - style={{ |
47 | | - position: 'fixed', |
48 | | - top: '50px', |
49 | | - right: '50px', |
50 | | - }} |
51 | | - > |
52 | | - <button type="button" onClick={() => setActiveIndex(0)}> |
53 | | - go to 0 |
54 | | - </button> |
55 | | - <button type="button" onClick={() => setActiveIndex(1)}> |
56 | | - go to 1 |
57 | | - </button> |
58 | | - <button type="button" onClick={() => setActiveIndex(2)}> |
59 | | - go to 2 |
60 | | - </button> |
61 | | - <button type="button" onClick={() => setActiveIndex(5)}> |
62 | | - go to 5 |
63 | | - </button> |
64 | | - <div>{activeIndex}</div> |
65 | | - </div> |
66 | | - </> |
| 8 | + <Routes> |
| 9 | + <Route path="/" element={<Home />} /> |
| 10 | + <Route path="/fullpage" element={<Fullpage />} /> |
| 11 | + </Routes> |
67 | 12 | ); |
68 | 13 | } |
69 | 14 |
|
|
0 commit comments