From 7d7bffc20afb381a816627cbd5d7237d16054cbb Mon Sep 17 00:00:00 2001
From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com>
Date: Mon, 10 Apr 2023 23:20:07 -0500
Subject: [PATCH] feat: add navigation between version 1 and 2
---
src/app/components/Main.module.css | 15 +++++++++++
src/app/components/Main.tsx | 23 ++++++++++++++++
src/app/components/NavBar.tsx | 39 ++++++++++++++++++---------
src/app/components/SideBar.tsx | 8 +++---
src/app/layout.tsx | 15 +----------
src/app/lib/markdoc.ts | 6 ++---
src/app/page.tsx | 25 ++++++++---------
src/app/types/types.ts | 2 +-
src/app/version-1/page.tsx | 22 +++++++++++++++
src/docs/version_001/docsStructure.ts | 10 +------
10 files changed, 106 insertions(+), 59 deletions(-)
create mode 100644 src/app/components/Main.module.css
create mode 100644 src/app/components/Main.tsx
create mode 100644 src/app/version-1/page.tsx
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 ? (