diff --git a/src/app/components/Main.module.css b/src/app/components/Main.module.css new file mode 100644 index 0000000..ceb333a --- /dev/null +++ b/src/app/components/Main.module.css @@ -0,0 +1,15 @@ +.container { + display: flex; + width: 100%; + flex-direction: column; + justify-content: flex-start; + align-items: center; + margin: 0 auto; + overflow-y: auto; +} + +.divider { + width: 100%; + height: 1px; + background-color: #848586; +} \ No newline at end of file diff --git a/src/app/components/Main.tsx b/src/app/components/Main.tsx new file mode 100644 index 0000000..aaefc94 --- /dev/null +++ b/src/app/components/Main.tsx @@ -0,0 +1,23 @@ +import { DocSection } from '../types/types'; +import styles from './Main.module.css'; +import Section from './Section'; + +export default function Main({ + versionSections, +}: { + versionSections: DocSection[]; +}) { + return ( +
+ {versionSections.map(section => ( + <> +
+ {section.copy} + {section.example} +
+
 
+ + ))} +
+ ); +} diff --git a/src/app/components/NavBar.tsx b/src/app/components/NavBar.tsx index 63080e7..6201e8c 100644 --- a/src/app/components/NavBar.tsx +++ b/src/app/components/NavBar.tsx @@ -2,17 +2,26 @@ import Link from 'next/link.js'; import { useState } from 'react'; +import { DocsStructure } from '../types/types.js'; import styles from './NavBar.module.css'; -function NavbarDropdown() { - const versions = ['Version 1', 'Version 2']; +function NavbarDropdown({ version }: { version: string }) { + const versions = { + version_001: { + name: 'Version 1', + path: '/version-1', + }, + version_002: { + name: 'Version 2', + path: '/', + }, + } as { [key: string]: { name: string; path: string } }; + + const currentVersion = versions[version]; const [isDropdownOpen, setIsDropdownOpen] = useState(false); - const [version, setVersion] = - useState('Version 2'); - const handleDropdownToggle = () => { setIsDropdownOpen(!isDropdownOpen); }; @@ -23,7 +32,7 @@ function NavbarDropdown() { className={styles.navLink} onClick={handleDropdownToggle} > - {version}{' '} + {currentVersion.name}{' '} {isDropdownOpen ? ( - {versions + {Object.keys(versions) .filter(v => v !== version) .map(v => ( - { - setVersion(v); setIsDropdownOpen(false); }} > - {v} - + {versions[v].name} + ))} ); } -export default function NavBar() { +export default function NavBar({ + version, +}: { + version: DocsStructure; +}) { return (