|
1 | 1 | import { useState } from 'react';
|
2 | 2 | import { ScrollingProvider, Section } from 'react-scroll-section';
|
3 |
| -import ModeToggle, { MenuKind } from './ModeToggle'; |
| 3 | +import ModeToggle, { Mode } from './ModeToggle'; |
4 | 4 | import { DynamicMenu, StaticMenu } from './Menu';
|
5 | 5 | import { Footer, Menu, SectionContainer } from './Builders';
|
6 | 6 | import logo from './logo.svg';
|
7 | 7 |
|
8 | 8 | function App() {
|
9 |
| - const [menu, setMenu] = useState<MenuKind>('dynamic'); |
10 |
| - const [sections, setSections] = useState(['s1']); |
| 9 | + const [mode, setMode] = useState<Mode>('dynamic'); |
11 | 10 |
|
12 | 11 | return (
|
13 | 12 | <ScrollingProvider>
|
14 |
| - <Menu>{menu === 'static' ? <StaticMenu /> : <DynamicMenu />}</Menu> |
| 13 | + <Menu>{mode === 'static' ? <StaticMenu /> : <DynamicMenu />}</Menu> |
15 | 14 |
|
16 | 15 | <Section id="home">
|
17 | 16 | <SectionContainer>
|
@@ -46,32 +45,8 @@ function App() {
|
46 | 45 | </SectionContainer>
|
47 | 46 | </Section>
|
48 | 47 |
|
49 |
| - {sections.map((name) => ( |
50 |
| - <Section id={name} key={name}> |
51 |
| - <SectionContainer> |
52 |
| - <span role="img" aria-label="letter"> |
53 |
| - {name} |
54 |
| - </span> |
55 |
| - <button |
56 |
| - onClick={() => { |
57 |
| - setSections((prev) => [...prev, 's' + (prev.length + 1)]); |
58 |
| - }} |
59 |
| - > |
60 |
| - Add |
61 |
| - </button> |
62 |
| - <button |
63 |
| - onClick={() => { |
64 |
| - setSections((prev) => prev.filter((s) => s !== name)); |
65 |
| - }} |
66 |
| - > |
67 |
| - Remove |
68 |
| - </button> |
69 |
| - </SectionContainer> |
70 |
| - </Section> |
71 |
| - ))} |
72 |
| - |
73 | 48 | <Footer>
|
74 |
| - <ModeToggle menu={menu} onChange={setMenu} /> |
| 49 | + <ModeToggle mode={mode} onChange={setMode} /> |
75 | 50 | <a href="https://www.netlify.com">
|
76 | 51 | <img
|
77 | 52 | src="https://www.netlify.com/img/global/badges/netlify-color-bg.svg"
|
|
0 commit comments