diff --git a/src/app/components/Article.module.css b/src/app/components/Article.module.css new file mode 100644 index 0000000..2517f15 --- /dev/null +++ b/src/app/components/Article.module.css @@ -0,0 +1,14 @@ +.container { + display: flex; + align-items: center; + width: 100%; + gap: 1rem; +} + +.copy { + flex: 1; +} + +.example { + flex: 1; +} \ No newline at end of file diff --git a/src/app/components/Article.tsx b/src/app/components/Article.tsx new file mode 100644 index 0000000..fd1d7fa --- /dev/null +++ b/src/app/components/Article.tsx @@ -0,0 +1,14 @@ +import styles from './Article.module.css'; + +export default function Article() { + return ( +
+
+ This is the copy +
+
+ This is the example +
+
+ ); +} diff --git a/src/app/components/SideBar.module.css b/src/app/components/SideBar.module.css index 16fee86..0e6510b 100644 --- a/src/app/components/SideBar.module.css +++ b/src/app/components/SideBar.module.css @@ -9,6 +9,7 @@ .title { font-size: 1rem; white-space: nowrap; + margin-bottom: 1rem; } .onspring { @@ -19,4 +20,41 @@ .api { font-weight: bold; color: #ee7203; +} + +.list { + display: flex; + flex-direction: column; + gap: 0.25rem; + white-space: nowrap; +} + +.listItem { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 0.5rem; + cursor: pointer; + padding: 0 0.5rem; +} + +.link { + text-decoration: none; + color: #a3acb9; +} + +.link:hover { + color: white; +} + +.expandable { + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + gap: 1rem; +} + +.chevron { + margin-left: 0.5rem; } \ No newline at end of file diff --git a/src/app/components/SideBar.tsx b/src/app/components/SideBar.tsx index 63f7703..86b01e4 100644 --- a/src/app/components/SideBar.tsx +++ b/src/app/components/SideBar.tsx @@ -1,12 +1,93 @@ +'use client'; + +import { useState } from 'react'; +import { DocsStructure } from '../types/types.js'; import styles from './SideBar.module.css'; -export default function SideBar() { +function TreeNode({ doc }: { doc: DocsStructure }) { + const [isExpanded, setIsExpanded] = + useState(true); + + const hasChildren = + doc.children && doc.children?.length > 0; + + return ( +
  • + {hasChildren ? ( +
    + setIsExpanded(!isExpanded)} + className={styles.link} + > + {doc.title} + + {isExpanded ? ( + + + + ) : ( + + + + )} +
    + ) : ( + + {doc.title} + + )} + + {doc.children && + doc.children?.length > 0 && + isExpanded && } +
  • + ); +} + +function ListTree({ docs }: { docs: DocsStructure[] }) { + return ( + + ); +} + +export default function SideBar({ + versionOne, + versionTwo, +}: { + versionOne: DocsStructure[]; + versionTwo: DocsStructure[]; +}) { return (

    Onspring{' '} API

    +
    ); } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index eb3680b..b1cad57 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,3 +1,5 @@ +import { versionOne } from '@/docs/version_001/docsStructure'; +import { versionTwo } from '@/docs/version_002/docsStructure'; import { ReactNode } from 'react'; import NavBar from './components/NavBar'; import SideBar from './components/SideBar'; @@ -16,7 +18,10 @@ export default function RootLayout({ return ( - +
    {children} diff --git a/src/app/page.module.css b/src/app/page.module.css index e69de29..92916cc 100644 --- a/src/app/page.module.css +++ b/src/app/page.module.css @@ -0,0 +1,10 @@ +.container { + margin: 0 auto; + max-width: 1450px; + padding: 5rem; + display: flex; + width: 100%; + flex-direction: column; + justify-content: center; + align-items: center; +} \ No newline at end of file diff --git a/src/app/page.tsx b/src/app/page.tsx index 638b437..d80e71f 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,9 +1,10 @@ +import Article from './components/Article'; import styles from './page.module.css'; export default function Home() { return ( -
    -

    Onspring API Docs

    -
    +
    +
    +
    ); } diff --git a/src/app/types/types.ts b/src/app/types/types.ts new file mode 100644 index 0000000..8741262 --- /dev/null +++ b/src/app/types/types.ts @@ -0,0 +1,7 @@ +export type DocsStructure = { + title: string; + folder: string; + copy?: string; + example?: string; + children?: DocsStructure[]; +}; diff --git a/src/docs/version_001/docsStructure.ts b/src/docs/version_001/docsStructure.ts new file mode 100644 index 0000000..278c3b6 --- /dev/null +++ b/src/docs/version_001/docsStructure.ts @@ -0,0 +1,11 @@ +import { DocsStructure } from '@/app/types/types'; + +export const versionOne: DocsStructure[] = [ + { + title: 'Introduction', + folder: 'introduction', + copy: 'copy.md', + example: 'example.md', + children: [], + }, +]; diff --git a/src/docs/version_002/docsStructure.ts b/src/docs/version_002/docsStructure.ts new file mode 100644 index 0000000..bddbd26 --- /dev/null +++ b/src/docs/version_002/docsStructure.ts @@ -0,0 +1,34 @@ +import { DocsStructure } from '@/app/types/types'; + +export const versionTwo: DocsStructure[] = [ + { + title: 'Introduction', + folder: 'introduction', + copy: 'copy.md', + example: 'example.md', + children: [ + { + title: 'What is this?', + folder: 'what-is-this', + copy: 'copy.md', + example: 'example.md', + children: [], + }, + ], + }, + { + title: 'Authentication', + folder: 'authentication', + copy: 'copy.md', + example: 'example.md', + children: [ + { + title: 'Login', + folder: 'login', + copy: 'copy.md', + example: 'example.md', + children: [], + }, + ], + }, +]; diff --git a/src/docs/version_002/introduction/copy.md b/src/docs/version_002/introduction/copy.md new file mode 100644 index 0000000..e69de29 diff --git a/src/docs/version_002/introduction/example.md b/src/docs/version_002/introduction/example.md new file mode 100644 index 0000000..e69de29