diff --git a/.vscode/settings.json b/.vscode/settings.json index 68d9b3b3..ac678f36 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,5 +38,9 @@ "files.exclude": { "node_modules": true }, - "editor.tabSize": 2 + "editor.tabSize": 2, + "[markdown]": { + "editor.wordWrap": "on", + "editor.quickSuggestions": false + } } \ No newline at end of file diff --git a/components/OrganizedContent.module.css b/components/OrganizedContent.module.css index 8c5dc5bb..b7bbe06f 100644 --- a/components/OrganizedContent.module.css +++ b/components/OrganizedContent.module.css @@ -2,20 +2,28 @@ display: flex; } -.wrapper h1 { - margin: 1rem 0; - font-size: calc(24rem / 16); - font-weight: 600; - color: var(--primary-accent); -} - .content { display: flex; flex-direction: column; width: 100%; } +.content h1 { + font-size: calc(24rem / 16); + color: var(--primary-accent); +} + +.content h2, +.content h3 { + font-size: calc(18rem / 16); + margin-top: calc(24rem / 16); + margin-bottom: calc(16rem / 16); +} + .nav { + top: calc(20rem / 16); + position: sticky; + height: 100%; margin: calc(8rem / 16) calc(32rem / 16) 0 0; color: var(--primary-heading); font-weight: 500; @@ -29,7 +37,7 @@ border-bottom: calc(1rem / 16) solid var(--primary-accent-light); align-items: center; height: calc(40rem / 16); - width: calc(284rem / 16); + width: calc(200rem / 16); padding: 0 calc(14rem / 16); cursor: pointer; } @@ -110,7 +118,25 @@ padding-left: calc(8rem / 16); } +.link, +.link:visited { + color: inherit; + text-decoration: none; +} + @media only screen and (max-width: calc(768rem / 16)) { + .content h1 { + font-size: calc(18rem / 16); + } + + .content h2, + .content h3, + .content h4 { + font-size: calc(18rem / 16); + margin-top: calc(24rem / 16); + margin-bottom: calc(8rem / 16); + } + .nav { display: none; } diff --git a/components/OrganizedContent.tsx b/components/OrganizedContent.tsx index 6d18db4c..2a490397 100644 --- a/components/OrganizedContent.tsx +++ b/components/OrganizedContent.tsx @@ -1,19 +1,13 @@ +import NextLink from "next/link"; import React, { ReactNode, ComponentType } from "react"; import styles from "./OrganizedContent.module.css"; -export interface LinkProps { - className?: string; - id: string; - children: ReactNode; -} - type Link = ComponentType; interface Section { id: string; title: string; - Content: ComponentType; } const READ_ALL_TITLE = "Read All"; @@ -21,16 +15,23 @@ export const READ_ALL_ID = "read-all"; interface Props { sections: Section[]; - currentId: string; + id: string; + children: ReactNode; link: Link; } -export function OrganizedContent(props: Props) { - const sections = createSections(props.sections); - const currentIndex = sections.findIndex(({ id }) => id === props.currentId); +export function OrganizedContent({ + sections, + id, + children, + link: Link, +}: Props) { + const currentIndex = sections.findIndex( + ({ id: sectionId }) => sectionId === id + ); if (currentIndex < 0) { - throw new Error(`Section with ID ${props.currentId} was not found`); + throw new Error(`Section with ID ${id} was not found`); } const section = sections[currentIndex]; @@ -38,20 +39,20 @@ export function OrganizedContent(props: Props) { return (
-