From 30e75b2b49276842a879948c873c46e9d8d1658c Mon Sep 17 00:00:00 2001 From: Dustin Goodman Date: Sun, 14 Aug 2022 10:31:42 -0500 Subject: [PATCH 1/8] add learn page layout elements (#115) --- src/components/Header.astro | 1 + src/components/Learn/Nav.astro | 36 ++++++++ src/components/Learn/TableOfContents.tsx | 94 +++++++++++++++++++++ src/layouts/learn.astro | 43 ++++++++++ src/pages/learn/index.astro | 22 +++++ src/utils/nav.ts | 100 +++++++++++++++++++++++ src/utils/unescapeHtml.ts | 8 ++ tsconfig.json | 6 +- 8 files changed, 309 insertions(+), 1 deletion(-) create mode 100644 src/components/Learn/Nav.astro create mode 100644 src/components/Learn/TableOfContents.tsx create mode 100644 src/layouts/learn.astro create mode 100644 src/pages/learn/index.astro create mode 100644 src/utils/nav.ts create mode 100644 src/utils/unescapeHtml.ts diff --git a/src/components/Header.astro b/src/components/Header.astro index 17d9390..d49e39d 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -12,6 +12,7 @@ import Logo from '@/components/Logo.astro';
About Blog + Learn diff --git a/src/components/Learn/Nav.astro b/src/components/Learn/Nav.astro new file mode 100644 index 0000000..c54da74 --- /dev/null +++ b/src/components/Learn/Nav.astro @@ -0,0 +1,36 @@ +--- +import { getSidebarNav, getRouteInfo } from '@/utils/nav'; + +export interface Props { + currentPage: string; +} + +const { currentPage } = Astro.props as Props; +const sidebarNav = getSidebarNav(currentPage); +const navPaths = sidebarNav.routes; +const routeInfo = getRouteInfo(sidebarNav, currentPage); +--- + + diff --git a/src/components/Learn/TableOfContents.tsx b/src/components/Learn/TableOfContents.tsx new file mode 100644 index 0000000..446ee01 --- /dev/null +++ b/src/components/Learn/TableOfContents.tsx @@ -0,0 +1,94 @@ +import type { FunctionalComponent } from 'preact'; +import { useState, useEffect, useRef } from 'preact/hooks'; +import cn from 'classnames'; +import { unescapeHtml } from '@/utils/unescapeHtml'; + +interface Props { + headers: { depth: number; slug: string; text: string }[]; +} + +const TableOfContents: FunctionalComponent = ({ headers = [] }) => { + const targetedHeaders = [...headers].filter( + ({ depth }) => depth > 1 && depth < 4 + ); + const toc = useRef(); + const [currentID, setCurrentID] = useState(targetedHeaders[0].slug); + const onThisPageID = 'on-this-page-heading'; + + useEffect(() => { + if (!toc.current) { + return; + } + + const setCurrent: IntersectionObserverCallback = (entries) => { + for (const entry of entries) { + if (entry.isIntersecting) { + const { id } = entry.target; + if (id === onThisPageID) { + continue; + } + setCurrentID(entry.target.id); + break; + } + } + }; + + const observerOptions: IntersectionObserverInit = { + // Negative top margin accounts for `scroll-margin`. + // Negative bottom margin means heading needs to be towards top of viewport to trigger intersection. + rootMargin: '-90px 0% -66%', + threshold: 1, + }; + + const headingsObserver = new IntersectionObserver( + setCurrent, + observerOptions + ); + + // Observe all the headings in the main page content. + document + .querySelectorAll('main :is(h1,h2,h3)') + .forEach((h) => headingsObserver.observe(h)); + + // Stop observing when the component is unmounted. + return () => headingsObserver.disconnect(); + }, [toc.current]); + + const onLinkClick = (e) => { + setCurrentID(e.target.getAttribute('href').replace('#', '')); + }; + + return ( + <> +

+ On This Page +

+ + + ); +}; + +export default TableOfContents; diff --git a/src/layouts/learn.astro b/src/layouts/learn.astro new file mode 100644 index 0000000..441c5c4 --- /dev/null +++ b/src/layouts/learn.astro @@ -0,0 +1,43 @@ +--- +import { MarkdownContent } from 'astro'; +import BaseLayout from '@/layouts/base.astro'; +import Header from '@/components/Header.astro'; +import Footer from '@/components/Footer.astro'; +import LearnNav from '@/components/Learn/Nav.astro'; +import TableOfContents from '@/components/Learn/TableOfContents'; + +export interface Props { + title: string; + description: string; + content: MarkdownContent; +} + +const { title, description, content } = Astro.props; +const url = new URL(Astro.request.url); +const currentPage = url.pathname; +const headers = content.astro?.headers; +--- + + +
+
+ + +
+
+ +
+
+
+
+ diff --git a/src/pages/learn/index.astro b/src/pages/learn/index.astro new file mode 100644 index 0000000..3513258 --- /dev/null +++ b/src/pages/learn/index.astro @@ -0,0 +1,22 @@ +--- +import HomeLayout from '@/layouts/home.astro'; +--- + + +
+

Learning Catalog

+

Lorem ipsum dolor...

+
+
+ +
+
diff --git a/src/utils/nav.ts b/src/utils/nav.ts new file mode 100644 index 0000000..ea4496a --- /dev/null +++ b/src/utils/nav.ts @@ -0,0 +1,100 @@ +interface RouteItem { + /** Page title (for the sidebar) */ + title: string; + /** Path to page */ + path?: string; + /** List of sub-routes */ + routes?: RouteItem[]; +} + +interface RouteMeta { + prevRoute?: RouteItem; + currentRoute?: RouteItem; + nextRoute?: RouteItem; + breadcrumbs?: RouteItem[]; +} + +// Converts the map of path modules returned by `import.meta.glob` to an object +// mapping the path module from each module's filepath to the module's path map +function mapDefaultExports(modules: Record) { + const exportMap: Record = {}; + Object.entries(modules).forEach(([path, module]) => { + const [_dot, _navData, pathMap] = path.split('/'); + exportMap[pathMap.replace('.json', '')] = module.default; + }); + return exportMap; +} + +const navData = mapDefaultExports( + import.meta.glob('../navData/*.json', { eager: true }) +); + +export function getSidebarNav(currentPage: string): RouteItem { + const [_empty, _learn, courseName] = currentPage.split('/'); + return navData[courseName]; +} + +export function getRouteInfo(routeTree: RouteItem, currentPage: string) { + const breadcrumbs = getBreadcrumbs(routeTree, currentPage); + const routeMeta = getRouteMeta(routeTree, currentPage); + return { + ...routeMeta, + breadcrumbs: breadcrumbs.length > 0 ? breadcrumbs : [routeTree], + }; +} + +function getRouteMeta( + routeTree: RouteItem, + currentPage: string, + ctx: RouteMeta = {} +): RouteMeta { + const { routes } = routeTree; + + if (ctx.currentRoute && !ctx.nextRoute) { + ctx.nextRoute = routeTree; + } + + if (routeTree.path === currentPage) { + ctx.currentRoute = routeTree; + } + + if (!ctx.currentRoute) { + ctx.prevRoute = routeTree; + } + + if (!routes) { + return ctx; + } + + for (const route of routes) { + getRouteMeta(route, currentPage, ctx); + } + + return ctx; +} + +function getBreadcrumbs( + routeTree: RouteItem, + currentPage: string, + breadcrumbs: RouteItem[] = [] +): RouteItem[] { + if (currentPage.includes(routeTree.path)) { + return breadcrumbs; + } + + if (!routeTree.routes) { + return []; + } + + for (const route of routeTree.routes) { + const childRoute = getBreadcrumbs(route, currentPage, [ + ...breadcrumbs, + routeTree, + ]); + if (childRoute?.length) { + return childRoute; + } + } + + return []; +} diff --git a/src/utils/unescapeHtml.ts b/src/utils/unescapeHtml.ts new file mode 100644 index 0000000..02b9ada --- /dev/null +++ b/src/utils/unescapeHtml.ts @@ -0,0 +1,8 @@ +export function unescapeHtml(escapedString: string) { + return escapedString + .replace(/&/g, '&') + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/"/g, '"') + .replace(/'/g, "'"); +} diff --git a/tsconfig.json b/tsconfig.json index 57accef..c60ca1a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,11 +2,15 @@ "moduleResolution": "node", "compilerOptions": { "baseUrl": ".", + "moduleResolution": "node", + "module": "ES2020", + "target": "ES2020", "paths": { "@/components/*": ["src/components/*"], "@/images/*": ["src/images/*"], "@/layouts/*": ["src/layouts/*"], - "@/types": ["src/types/index"] + "@/types": ["src/types/index"], + "@/utils/*": ["src/utils/*"] } } } From 3680b7fd3e1be08d6578a4980044f0a1b9d0f95a Mon Sep 17 00:00:00 2001 From: Dustin Goodman Date: Sun, 14 Aug 2022 10:35:01 -0500 Subject: [PATCH 2/8] add CloseIcon and MenuIcon (#117) --- src/components/Icons/CloseIcon.jsx | 17 +++++++++++++++++ src/components/Icons/MenuIcon.jsx | 17 +++++++++++++++++ src/components/Icons/index.jsx | 2 ++ 3 files changed, 36 insertions(+) create mode 100644 src/components/Icons/CloseIcon.jsx create mode 100644 src/components/Icons/MenuIcon.jsx diff --git a/src/components/Icons/CloseIcon.jsx b/src/components/Icons/CloseIcon.jsx new file mode 100644 index 0000000..59f0645 --- /dev/null +++ b/src/components/Icons/CloseIcon.jsx @@ -0,0 +1,17 @@ +function CloseIcon({ className = '' }) { + return ( + + + + + ); +} + +export default CloseIcon; diff --git a/src/components/Icons/MenuIcon.jsx b/src/components/Icons/MenuIcon.jsx new file mode 100644 index 0000000..083acbc --- /dev/null +++ b/src/components/Icons/MenuIcon.jsx @@ -0,0 +1,17 @@ +function MenuIcon({ className = '' }) { + return ( + + + + + ); +} + +export default MenuIcon; diff --git a/src/components/Icons/index.jsx b/src/components/Icons/index.jsx index 549a4ed..f42bcf1 100644 --- a/src/components/Icons/index.jsx +++ b/src/components/Icons/index.jsx @@ -1,6 +1,8 @@ +export { default as CloseIcon } from './CloseIcon'; export { default as CodeIcon } from './CodeIcon'; export { default as DevToIcon } from './DevToIcon'; export { default as GithubIcon } from './GithubIcon'; +export { default as MenuIcon } from './MenuIcon'; export { default as MicIcon } from './MicIcon'; export { default as MoonIcon } from './MoonIcon'; export { default as PencilIcon } from './PencilIcon'; From 3483868da42ad5a533a72de60c44fb103b419ecf Mon Sep 17 00:00:00 2001 From: Dustin Goodman Date: Sun, 14 Aug 2022 11:25:50 -0500 Subject: [PATCH 3/8] scaffold Programming Fundamentals content (#118) * add script for scaffolding out content from toc * add programming fundamentals toc * generate programming fundamentals pages * fix bug in TableOfContents component when no relevant headers --- ops/scaffold-pages.py | 34 ++ src/components/Learn/TableOfContents.tsx | 2 +- src/navData/programming-fundamentals.json | 310 ++++++++++++++++++ .../abstract-classes-and-interfaces.md | 6 + .../arithmetic-operators.md | 6 + .../learn/programming-fundamentals/arrays.md | 6 + .../bitwise-operators.md | 6 + .../programming-fundamentals/catch-blocks.md | 6 + .../class-inheritence.md | 6 + .../command-line-interactions.md | 6 + .../compiled-v-interpretted.md | 6 + .../conditional-statements.md | 6 + .../converting-recrusion-to-loops.md | 6 + .../creating-objects.md | 6 + .../programming-fundamentals/data-types.md | 6 + .../programming-fundamentals/debugging.md | 6 + .../displaying-output.md | 6 + .../learn/programming-fundamentals/errors.md | 6 + .../exception-handling.md | 6 + .../learn/programming-fundamentals/file-io.md | 6 + .../file-permissions.md | 6 + .../file-streaming.md | 6 + .../finally-blocks.md | 6 + .../function-parameters.md | 6 + .../functional-decomposition.md | 6 + .../functional-looping.md | 6 + .../functions-and-methods.md | 6 + .../functions-and-running-programs.md | 6 + .../how-programs-work.md | 6 + .../how-to-use-regular-expressions.md | 6 + .../how-to-use-this-book.md | 6 + .../programming-fundamentals/introduction.md | 6 + .../logical-operators.md | 6 + .../learn/programming-fundamentals/loops.md | 6 + .../maps-dictionaries-tables.md | 6 + .../multi-dimensional-arrays.md | 6 + .../learn/programming-fundamentals/objects.md | 6 + .../our-first-recursive-function.md | 6 + .../pattern-matching-and-grouping.md | 6 + .../picking-conditional-pattern.md | 6 + .../programming-fundamentals/polymorphism.md | 6 + .../programming-fundamentals/programming.md | 6 + .../programming-fundamentals/reading-files.md | 6 + .../programming-fundamentals/recursion.md | 6 + .../regular-expression-special-tokens.md | 6 + .../regular-expressions.md | 6 + .../programming-fundamentals/return-values.md | 6 + .../programming-fundamentals/special-loops.md | 6 + .../styles-of-programming.md | 6 + .../learn/programming-fundamentals/syntax.md | 6 + .../the-command-line.md | 6 + .../the-do-while-loop.md | 6 + .../the-else-if-statement.md | 6 + .../the-else-statement.md | 6 + .../programming-fundamentals/the-for-loop.md | 6 + .../the-if-statement.md | 6 + .../the-switch-statement.md | 6 + .../the-ternary-operator.md | 6 + .../the-while-loop.md | 6 + .../tracing-recursive-functions.md | 6 + .../programming-fundamentals/try-blocks.md | 6 + .../types-of-exceptions.md | 6 + .../value-v-reference.md | 6 + .../variable-assignment.md | 6 + .../programming-fundamentals/variables.md | 6 + .../what-are-conditional-statements.md | 6 + .../what-are-data-types.md | 6 + .../what-are-loops.md | 6 + .../what-is-an-object.md | 6 + .../what-is-recursion.md | 6 + .../programming-fundamentals/what-next.md | 6 + .../programming-fundamentals/why-this-book.md | 6 + .../why-use-recursion.md | 6 + .../programming-fundamentals/writing-files.md | 6 + 74 files changed, 771 insertions(+), 1 deletion(-) create mode 100644 ops/scaffold-pages.py create mode 100644 src/navData/programming-fundamentals.json create mode 100644 src/pages/learn/programming-fundamentals/abstract-classes-and-interfaces.md create mode 100644 src/pages/learn/programming-fundamentals/arithmetic-operators.md create mode 100644 src/pages/learn/programming-fundamentals/arrays.md create mode 100644 src/pages/learn/programming-fundamentals/bitwise-operators.md create mode 100644 src/pages/learn/programming-fundamentals/catch-blocks.md create mode 100644 src/pages/learn/programming-fundamentals/class-inheritence.md create mode 100644 src/pages/learn/programming-fundamentals/command-line-interactions.md create mode 100644 src/pages/learn/programming-fundamentals/compiled-v-interpretted.md create mode 100644 src/pages/learn/programming-fundamentals/conditional-statements.md create mode 100644 src/pages/learn/programming-fundamentals/converting-recrusion-to-loops.md create mode 100644 src/pages/learn/programming-fundamentals/creating-objects.md create mode 100644 src/pages/learn/programming-fundamentals/data-types.md create mode 100644 src/pages/learn/programming-fundamentals/debugging.md create mode 100644 src/pages/learn/programming-fundamentals/displaying-output.md create mode 100644 src/pages/learn/programming-fundamentals/errors.md create mode 100644 src/pages/learn/programming-fundamentals/exception-handling.md create mode 100644 src/pages/learn/programming-fundamentals/file-io.md create mode 100644 src/pages/learn/programming-fundamentals/file-permissions.md create mode 100644 src/pages/learn/programming-fundamentals/file-streaming.md create mode 100644 src/pages/learn/programming-fundamentals/finally-blocks.md create mode 100644 src/pages/learn/programming-fundamentals/function-parameters.md create mode 100644 src/pages/learn/programming-fundamentals/functional-decomposition.md create mode 100644 src/pages/learn/programming-fundamentals/functional-looping.md create mode 100644 src/pages/learn/programming-fundamentals/functions-and-methods.md create mode 100644 src/pages/learn/programming-fundamentals/functions-and-running-programs.md create mode 100644 src/pages/learn/programming-fundamentals/how-programs-work.md create mode 100644 src/pages/learn/programming-fundamentals/how-to-use-regular-expressions.md create mode 100644 src/pages/learn/programming-fundamentals/how-to-use-this-book.md create mode 100644 src/pages/learn/programming-fundamentals/introduction.md create mode 100644 src/pages/learn/programming-fundamentals/logical-operators.md create mode 100644 src/pages/learn/programming-fundamentals/loops.md create mode 100644 src/pages/learn/programming-fundamentals/maps-dictionaries-tables.md create mode 100644 src/pages/learn/programming-fundamentals/multi-dimensional-arrays.md create mode 100644 src/pages/learn/programming-fundamentals/objects.md create mode 100644 src/pages/learn/programming-fundamentals/our-first-recursive-function.md create mode 100644 src/pages/learn/programming-fundamentals/pattern-matching-and-grouping.md create mode 100644 src/pages/learn/programming-fundamentals/picking-conditional-pattern.md create mode 100644 src/pages/learn/programming-fundamentals/polymorphism.md create mode 100644 src/pages/learn/programming-fundamentals/programming.md create mode 100644 src/pages/learn/programming-fundamentals/reading-files.md create mode 100644 src/pages/learn/programming-fundamentals/recursion.md create mode 100644 src/pages/learn/programming-fundamentals/regular-expression-special-tokens.md create mode 100644 src/pages/learn/programming-fundamentals/regular-expressions.md create mode 100644 src/pages/learn/programming-fundamentals/return-values.md create mode 100644 src/pages/learn/programming-fundamentals/special-loops.md create mode 100644 src/pages/learn/programming-fundamentals/styles-of-programming.md create mode 100644 src/pages/learn/programming-fundamentals/syntax.md create mode 100644 src/pages/learn/programming-fundamentals/the-command-line.md create mode 100644 src/pages/learn/programming-fundamentals/the-do-while-loop.md create mode 100644 src/pages/learn/programming-fundamentals/the-else-if-statement.md create mode 100644 src/pages/learn/programming-fundamentals/the-else-statement.md create mode 100644 src/pages/learn/programming-fundamentals/the-for-loop.md create mode 100644 src/pages/learn/programming-fundamentals/the-if-statement.md create mode 100644 src/pages/learn/programming-fundamentals/the-switch-statement.md create mode 100644 src/pages/learn/programming-fundamentals/the-ternary-operator.md create mode 100644 src/pages/learn/programming-fundamentals/the-while-loop.md create mode 100644 src/pages/learn/programming-fundamentals/tracing-recursive-functions.md create mode 100644 src/pages/learn/programming-fundamentals/try-blocks.md create mode 100644 src/pages/learn/programming-fundamentals/types-of-exceptions.md create mode 100644 src/pages/learn/programming-fundamentals/value-v-reference.md create mode 100644 src/pages/learn/programming-fundamentals/variable-assignment.md create mode 100644 src/pages/learn/programming-fundamentals/variables.md create mode 100644 src/pages/learn/programming-fundamentals/what-are-conditional-statements.md create mode 100644 src/pages/learn/programming-fundamentals/what-are-data-types.md create mode 100644 src/pages/learn/programming-fundamentals/what-are-loops.md create mode 100644 src/pages/learn/programming-fundamentals/what-is-an-object.md create mode 100644 src/pages/learn/programming-fundamentals/what-is-recursion.md create mode 100644 src/pages/learn/programming-fundamentals/what-next.md create mode 100644 src/pages/learn/programming-fundamentals/why-this-book.md create mode 100644 src/pages/learn/programming-fundamentals/why-use-recursion.md create mode 100644 src/pages/learn/programming-fundamentals/writing-files.md diff --git a/ops/scaffold-pages.py b/ops/scaffold-pages.py new file mode 100644 index 0000000..93e7703 --- /dev/null +++ b/ops/scaffold-pages.py @@ -0,0 +1,34 @@ +import json + +default_file_content = '''\ +--- +title: {title} +layout: '@/layouts/learn.astro' +--- + +TODO: add content +''' + + +def get_json_contents(filename): + with open(f'src/navData/{filename}.json') as f: + return json.load(f) + + +def create_doc(route): + filepath = f"src/pages/{route.get('path')}.md" + file_content = default_file_content.format(title=route.get('title')) + with open(filepath, 'w+') as file: + file.write(file_content) + + +def iterate_toc(toc): + for route in toc.get('routes'): + if bool(route.get('routes')): + iterate_toc(route) + create_doc(route) + + +filename = input('Source File: ') +toc = get_json_contents(filename) +iterate_toc(toc) diff --git a/src/components/Learn/TableOfContents.tsx b/src/components/Learn/TableOfContents.tsx index 446ee01..2a617af 100644 --- a/src/components/Learn/TableOfContents.tsx +++ b/src/components/Learn/TableOfContents.tsx @@ -12,7 +12,7 @@ const TableOfContents: FunctionalComponent = ({ headers = [] }) => { ({ depth }) => depth > 1 && depth < 4 ); const toc = useRef(); - const [currentID, setCurrentID] = useState(targetedHeaders[0].slug); + const [currentID, setCurrentID] = useState(targetedHeaders?.[0]?.slug); const onThisPageID = 'on-this-page-heading'; useEffect(() => { diff --git a/src/navData/programming-fundamentals.json b/src/navData/programming-fundamentals.json new file mode 100644 index 0000000..c49ff4c --- /dev/null +++ b/src/navData/programming-fundamentals.json @@ -0,0 +1,310 @@ +{ + "title": "Programming Fundamentals", + "path": "/learn/programming-fundamentals", + "routes": [ + { + "title": "Chapter 0: Introduction", + "path": "/learn/programming-fundamentals/introduction", + "routes": [ + { + "title": "Why this book?", + "path": "/learn/programming-fundamentals/why-this-book" + }, + { + "title": "How to use this book", + "path": "/learn/programming-fundamentals/how-to-use-this-book" + }, + { + "title": "Programming", + "path": "/learn/programming-fundamentals/programming" + }, + { + "title": "The Command Line", + "path": "/learn/programming-fundamentals/the-command-line" + }, + { + "title": "How programs work", + "path": "/learn/programming-fundamentals/how-programs-work" + }, + { + "title": "Compiled v Interpretted", + "path": "/learn/programming-fundamentals/compiled-v-interpretted" + }, + { + "title": "Syntax", + "path": "/learn/programming-fundamentals/syntax" + }, + { + "title": "Styles of Programming", + "path": "/learn/programming-fundamentals/styles-of-programming" + } + ] + }, + { + "title": "Chapter 1: Data Types", + "path": "/learn/programming-fundamentals/data-types", + "routes": [ + { + "title": "What are data types?", + "path": "/learn/programming-fundamentals/what-are-data-types" + }, + { + "title": "Variables", + "path": "/learn/programming-fundamentals/variables" + }, + { + "title": "Variable Assignment", + "path": "/learn/programming-fundamentals/variable-assignment" + }, + { + "title": "Arithmetic Operators", + "path": "/learn/programming-fundamentals/arithmetic-operators" + }, + { + "title": "Logical Operators", + "path": "/learn/programming-fundamentals/logical-operators" + }, + { + "title": "Bitwise Operators", + "path": "/learn/programming-fundamentals/bitwise-operators" + }, + { + "title": "Arrays", + "path": "/learn/programming-fundamentals/arrays" + }, + { + "title": "Multi-dimensional Arrays", + "path": "/learn/programming-fundamentals/multi-dimensional-arrays" + } + ] + }, + { + "title": "Chapter 2: Functions and Running Programs", + "path": "/learn/programming-fundamentals/functions-and-running-programs", + "routes": [ + { + "title": "Functions and Methods", + "path": "/learn/programming-fundamentals/functions-and-methods" + }, + { + "title": "Function Parameters", + "path": "/learn/programming-fundamentals/function-parameters" + }, + { + "title": "Value v Reference", + "path": "/learn/programming-fundamentals/value-v-reference" + }, + { + "title": "Functional Decomposition", + "path": "/learn/programming-fundamentals/functional-decomposition" + }, + { + "title": "Return Values", + "path": "/learn/programming-fundamentals/return-values" + }, + { + "title": "Displaying Output", + "path": "/learn/programming-fundamentals/displaying-output" + }, + { + "title": "Errors", + "path": "/learn/programming-fundamentals/errors" + }, + { + "title": "Debugging", + "path": "/learn/programming-fundamentals/debugging" + } + ] + }, + { + "title": "Chapter 3: Conditional Statements", + "path": "/learn/programming-fundamentals/conditional-statements", + "routes": [ + { + "title": "What are conditional statements?", + "path": "/learn/programming-fundamentals/what-are-conditional-statements" + }, + { + "title": "The if Statement", + "path": "/learn/programming-fundamentals/the-if-statement" + }, + { + "title": "The else Statement", + "path": "/learn/programming-fundamentals/the-else-statement" + }, + { + "title": "The else if statement", + "path": "/learn/programming-fundamentals/the-else-if-statement" + }, + { + "title": "The Ternary Operator", + "path": "/learn/programming-fundamentals/the-ternary-operator" + }, + { + "title": "The switch statement", + "path": "/learn/programming-fundamentals/the-switch-statement" + }, + { + "title": "How to pick your conditional pattern", + "path": "/learn/programming-fundamentals/picking-conditional-pattern" + } + ] + }, + { + "title": "Chapter 4: Loops", + "path": "/learn/programming-fundamentals/loops", + "routes": [ + { + "title": "What are loops?", + "path": "/learn/programming-fundamentals/what-are-loops" + }, + { + "title": "The while Loop", + "path": "/learn/programming-fundamentals/the-while-loop" + }, + { + "title": "The do while Loop", + "path": "/learn/programming-fundamentals/the-do-while-loop" + }, + { + "title": "The for Loop", + "path": "/learn/programming-fundamentals/the-for-loop" + }, + { + "title": "Functional Looping", + "path": "/learn/programming-fundamentals/functional-looping" + }, + { + "title": "Special Loops", + "path": "/learn/programming-fundamentals/special-loops" + } + ] + }, + { + "title": "Chapter 5: Recursion", + "path": "/learn/programming-fundamentals/recursion", + "routes": [ + { + "title": "What is recursion?", + "path": "/learn/programming-fundamentals/what-is-recursion" + }, + { + "title": "Why use recursion?", + "path": "/learn/programming-fundamentals/why-use-recursion" + }, + { + "title": "Our first recursive function", + "path": "/learn/programming-fundamentals/our-first-recursive-function" + }, + { + "title": "Tracing recursive functions", + "path": "/learn/programming-fundamentals/tracing-recursive-functions" + }, + { + "title": "Converting Recursion to Loops", + "path": "/learn/programming-fundamentals/converting-recrusion-to-loops" + } + ] + }, + { + "title": "Chapter 6: Objects", + "path": "/learn/programming-fundamentals/objects", + "routes": [ + { + "title": "What is an object?", + "path": "/learn/programming-fundamentals/what-is-an-object" + }, + { + "title": "Maps, Dictionaries, Tables", + "path": "/learn/programming-fundamentals/maps-dictionaries-tables" + }, + { + "title": "Creating Objects", + "path": "/learn/programming-fundamentals/creating-objects" + }, + { + "title": "Class Inheritence", + "path": "/learn/programming-fundamentals/class-inheritence" + }, + { + "title": "Abstract Classes and Interfaces", + "path": "/learn/programming-fundamentals/abstract-classes-and-interfaces" + }, + { + "title": "Polymorphism", + "path": "/learn/programming-fundamentals/polymorphism" + } + ] + }, + { + "title": "Chapter 7: Regular Expressions", + "path": "/learn/programming-fundamentals/regular-expressions", + "routes": [ + { + "title": "How to use regular expressions?", + "path": "/learn/programming-fundamentals/how-to-use-regular-expressions" + }, + { + "title": "Regular Expression Special Tokens", + "path": "/learn/programming-fundamentals/regular-expression-special-tokens" + }, + { + "title": "Pattern Matching and Grouping", + "path": "/learn/programming-fundamentals/pattern-matching-and-grouping" + } + ] + }, + { + "title": "Chapter 8: File I/O", + "path": "/learn/programming-fundamentals/file-io", + "routes": [ + { + "title": "File Permissions", + "path": "/learn/programming-fundamentals/file-permissions" + }, + { + "title": "Command Line Interactions", + "path": "/learn/programming-fundamentals/command-line-interactions" + }, + { + "title": "Reading Files", + "path": "/learn/programming-fundamentals/reading-files" + }, + { + "title": "Writing Files", + "path": "/learn/programming-fundamentals/writing-files" + }, + { + "title": "File Streaming", + "path": "/learn/programming-fundamentals/file-streaming" + } + ] + }, + { + "title": "Chapter 9: Exception Handling", + "path": "/learn/programming-fundamentals/exception-handling", + "routes": [ + { + "title": "Types of Exceptions", + "path": "/learn/programming-fundamentals/types-of-exceptions" + }, + { + "title": "try Blocks", + "path": "/learn/programming-fundamentals/try-blocks" + }, + { + "title": "catch Blocks", + "path": "/learn/programming-fundamentals/catch-blocks" + }, + { + "title": "finally Blocks", + "path": "/learn/programming-fundamentals/finally-blocks" + } + ] + }, + { + "title": "Chapter 10: What next?", + "path": "/learn/programming-fundamentals/what-next" + } + ] +} diff --git a/src/pages/learn/programming-fundamentals/abstract-classes-and-interfaces.md b/src/pages/learn/programming-fundamentals/abstract-classes-and-interfaces.md new file mode 100644 index 0000000..cc3672a --- /dev/null +++ b/src/pages/learn/programming-fundamentals/abstract-classes-and-interfaces.md @@ -0,0 +1,6 @@ +--- +title: Abstract Classes and Interfaces +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/arithmetic-operators.md b/src/pages/learn/programming-fundamentals/arithmetic-operators.md new file mode 100644 index 0000000..e012e6c --- /dev/null +++ b/src/pages/learn/programming-fundamentals/arithmetic-operators.md @@ -0,0 +1,6 @@ +--- +title: Arithmetic Operators +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/arrays.md b/src/pages/learn/programming-fundamentals/arrays.md new file mode 100644 index 0000000..8baac27 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/arrays.md @@ -0,0 +1,6 @@ +--- +title: Arrays +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/bitwise-operators.md b/src/pages/learn/programming-fundamentals/bitwise-operators.md new file mode 100644 index 0000000..d233b45 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/bitwise-operators.md @@ -0,0 +1,6 @@ +--- +title: Bitwise Operators +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/catch-blocks.md b/src/pages/learn/programming-fundamentals/catch-blocks.md new file mode 100644 index 0000000..0b719ab --- /dev/null +++ b/src/pages/learn/programming-fundamentals/catch-blocks.md @@ -0,0 +1,6 @@ +--- +title: catch Blocks +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/class-inheritence.md b/src/pages/learn/programming-fundamentals/class-inheritence.md new file mode 100644 index 0000000..80641bc --- /dev/null +++ b/src/pages/learn/programming-fundamentals/class-inheritence.md @@ -0,0 +1,6 @@ +--- +title: Class Inheritence +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/command-line-interactions.md b/src/pages/learn/programming-fundamentals/command-line-interactions.md new file mode 100644 index 0000000..2f89ab6 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/command-line-interactions.md @@ -0,0 +1,6 @@ +--- +title: Command Line Interactions +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/compiled-v-interpretted.md b/src/pages/learn/programming-fundamentals/compiled-v-interpretted.md new file mode 100644 index 0000000..4262585 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/compiled-v-interpretted.md @@ -0,0 +1,6 @@ +--- +title: Compiled v Interpretted +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/conditional-statements.md b/src/pages/learn/programming-fundamentals/conditional-statements.md new file mode 100644 index 0000000..5eb67ea --- /dev/null +++ b/src/pages/learn/programming-fundamentals/conditional-statements.md @@ -0,0 +1,6 @@ +--- +title: Conditional Statements +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/converting-recrusion-to-loops.md b/src/pages/learn/programming-fundamentals/converting-recrusion-to-loops.md new file mode 100644 index 0000000..cbce1cc --- /dev/null +++ b/src/pages/learn/programming-fundamentals/converting-recrusion-to-loops.md @@ -0,0 +1,6 @@ +--- +title: Converting Recursion to Loops +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/creating-objects.md b/src/pages/learn/programming-fundamentals/creating-objects.md new file mode 100644 index 0000000..35dbc1f --- /dev/null +++ b/src/pages/learn/programming-fundamentals/creating-objects.md @@ -0,0 +1,6 @@ +--- +title: Creating Objects +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/data-types.md b/src/pages/learn/programming-fundamentals/data-types.md new file mode 100644 index 0000000..7f3cd83 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/data-types.md @@ -0,0 +1,6 @@ +--- +title: Data Types +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/debugging.md b/src/pages/learn/programming-fundamentals/debugging.md new file mode 100644 index 0000000..776de83 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/debugging.md @@ -0,0 +1,6 @@ +--- +title: Debugging +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/displaying-output.md b/src/pages/learn/programming-fundamentals/displaying-output.md new file mode 100644 index 0000000..21fd19d --- /dev/null +++ b/src/pages/learn/programming-fundamentals/displaying-output.md @@ -0,0 +1,6 @@ +--- +title: Displaying Output +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/errors.md b/src/pages/learn/programming-fundamentals/errors.md new file mode 100644 index 0000000..c63b225 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/errors.md @@ -0,0 +1,6 @@ +--- +title: Errors +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/exception-handling.md b/src/pages/learn/programming-fundamentals/exception-handling.md new file mode 100644 index 0000000..0c7864a --- /dev/null +++ b/src/pages/learn/programming-fundamentals/exception-handling.md @@ -0,0 +1,6 @@ +--- +title: Exception Handling +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/file-io.md b/src/pages/learn/programming-fundamentals/file-io.md new file mode 100644 index 0000000..375decd --- /dev/null +++ b/src/pages/learn/programming-fundamentals/file-io.md @@ -0,0 +1,6 @@ +--- +title: File I/O +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/file-permissions.md b/src/pages/learn/programming-fundamentals/file-permissions.md new file mode 100644 index 0000000..48aab34 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/file-permissions.md @@ -0,0 +1,6 @@ +--- +title: File Permissions +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/file-streaming.md b/src/pages/learn/programming-fundamentals/file-streaming.md new file mode 100644 index 0000000..e1fc53d --- /dev/null +++ b/src/pages/learn/programming-fundamentals/file-streaming.md @@ -0,0 +1,6 @@ +--- +title: File Streaming +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/finally-blocks.md b/src/pages/learn/programming-fundamentals/finally-blocks.md new file mode 100644 index 0000000..6fc532b --- /dev/null +++ b/src/pages/learn/programming-fundamentals/finally-blocks.md @@ -0,0 +1,6 @@ +--- +title: finally Blocks +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/function-parameters.md b/src/pages/learn/programming-fundamentals/function-parameters.md new file mode 100644 index 0000000..2bb3a12 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/function-parameters.md @@ -0,0 +1,6 @@ +--- +title: Function Parameters +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/functional-decomposition.md b/src/pages/learn/programming-fundamentals/functional-decomposition.md new file mode 100644 index 0000000..84b7dd9 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/functional-decomposition.md @@ -0,0 +1,6 @@ +--- +title: Functional Decomposition +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/functional-looping.md b/src/pages/learn/programming-fundamentals/functional-looping.md new file mode 100644 index 0000000..a92a1e3 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/functional-looping.md @@ -0,0 +1,6 @@ +--- +title: Functional Looping +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/functions-and-methods.md b/src/pages/learn/programming-fundamentals/functions-and-methods.md new file mode 100644 index 0000000..a089c72 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/functions-and-methods.md @@ -0,0 +1,6 @@ +--- +title: Functions and Methods +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/functions-and-running-programs.md b/src/pages/learn/programming-fundamentals/functions-and-running-programs.md new file mode 100644 index 0000000..34fb690 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/functions-and-running-programs.md @@ -0,0 +1,6 @@ +--- +title: Functions and Running Programs +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/how-programs-work.md b/src/pages/learn/programming-fundamentals/how-programs-work.md new file mode 100644 index 0000000..3fb2fb4 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/how-programs-work.md @@ -0,0 +1,6 @@ +--- +title: How programs work +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/how-to-use-regular-expressions.md b/src/pages/learn/programming-fundamentals/how-to-use-regular-expressions.md new file mode 100644 index 0000000..4e2e49a --- /dev/null +++ b/src/pages/learn/programming-fundamentals/how-to-use-regular-expressions.md @@ -0,0 +1,6 @@ +--- +title: How to use regular expressions? +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/how-to-use-this-book.md b/src/pages/learn/programming-fundamentals/how-to-use-this-book.md new file mode 100644 index 0000000..5978d1b --- /dev/null +++ b/src/pages/learn/programming-fundamentals/how-to-use-this-book.md @@ -0,0 +1,6 @@ +--- +title: How to use this book +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/introduction.md b/src/pages/learn/programming-fundamentals/introduction.md new file mode 100644 index 0000000..c2a08eb --- /dev/null +++ b/src/pages/learn/programming-fundamentals/introduction.md @@ -0,0 +1,6 @@ +--- +title: Introduction +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/logical-operators.md b/src/pages/learn/programming-fundamentals/logical-operators.md new file mode 100644 index 0000000..e873a58 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/logical-operators.md @@ -0,0 +1,6 @@ +--- +title: Logical Operators +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/loops.md b/src/pages/learn/programming-fundamentals/loops.md new file mode 100644 index 0000000..16db6be --- /dev/null +++ b/src/pages/learn/programming-fundamentals/loops.md @@ -0,0 +1,6 @@ +--- +title: Loops +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/maps-dictionaries-tables.md b/src/pages/learn/programming-fundamentals/maps-dictionaries-tables.md new file mode 100644 index 0000000..528fbab --- /dev/null +++ b/src/pages/learn/programming-fundamentals/maps-dictionaries-tables.md @@ -0,0 +1,6 @@ +--- +title: Maps, Dictionaries, Tables +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/multi-dimensional-arrays.md b/src/pages/learn/programming-fundamentals/multi-dimensional-arrays.md new file mode 100644 index 0000000..f719cda --- /dev/null +++ b/src/pages/learn/programming-fundamentals/multi-dimensional-arrays.md @@ -0,0 +1,6 @@ +--- +title: Multi-dimensional Arrays +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/objects.md b/src/pages/learn/programming-fundamentals/objects.md new file mode 100644 index 0000000..6f1d830 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/objects.md @@ -0,0 +1,6 @@ +--- +title: Objects +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/our-first-recursive-function.md b/src/pages/learn/programming-fundamentals/our-first-recursive-function.md new file mode 100644 index 0000000..e69c73a --- /dev/null +++ b/src/pages/learn/programming-fundamentals/our-first-recursive-function.md @@ -0,0 +1,6 @@ +--- +title: Our first recursive function +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/pattern-matching-and-grouping.md b/src/pages/learn/programming-fundamentals/pattern-matching-and-grouping.md new file mode 100644 index 0000000..3fb0067 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/pattern-matching-and-grouping.md @@ -0,0 +1,6 @@ +--- +title: Pattern Matching and Grouping +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/picking-conditional-pattern.md b/src/pages/learn/programming-fundamentals/picking-conditional-pattern.md new file mode 100644 index 0000000..55b3c66 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/picking-conditional-pattern.md @@ -0,0 +1,6 @@ +--- +title: How to pick your conditional pattern +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/polymorphism.md b/src/pages/learn/programming-fundamentals/polymorphism.md new file mode 100644 index 0000000..a1bb001 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/polymorphism.md @@ -0,0 +1,6 @@ +--- +title: Polymorphism +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/programming.md b/src/pages/learn/programming-fundamentals/programming.md new file mode 100644 index 0000000..d1da765 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/programming.md @@ -0,0 +1,6 @@ +--- +title: Programming +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/reading-files.md b/src/pages/learn/programming-fundamentals/reading-files.md new file mode 100644 index 0000000..686ce58 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/reading-files.md @@ -0,0 +1,6 @@ +--- +title: Reading Files +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/recursion.md b/src/pages/learn/programming-fundamentals/recursion.md new file mode 100644 index 0000000..83de016 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/recursion.md @@ -0,0 +1,6 @@ +--- +title: Recursion +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/regular-expression-special-tokens.md b/src/pages/learn/programming-fundamentals/regular-expression-special-tokens.md new file mode 100644 index 0000000..44da877 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/regular-expression-special-tokens.md @@ -0,0 +1,6 @@ +--- +title: Regular Expression Special Tokens +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/regular-expressions.md b/src/pages/learn/programming-fundamentals/regular-expressions.md new file mode 100644 index 0000000..4f23d40 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/regular-expressions.md @@ -0,0 +1,6 @@ +--- +title: Regular Expressions +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/return-values.md b/src/pages/learn/programming-fundamentals/return-values.md new file mode 100644 index 0000000..02f3731 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/return-values.md @@ -0,0 +1,6 @@ +--- +title: Return Values +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/special-loops.md b/src/pages/learn/programming-fundamentals/special-loops.md new file mode 100644 index 0000000..a63adc9 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/special-loops.md @@ -0,0 +1,6 @@ +--- +title: Special Loops +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/styles-of-programming.md b/src/pages/learn/programming-fundamentals/styles-of-programming.md new file mode 100644 index 0000000..c0273e3 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/styles-of-programming.md @@ -0,0 +1,6 @@ +--- +title: Styles of Programming +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/syntax.md b/src/pages/learn/programming-fundamentals/syntax.md new file mode 100644 index 0000000..074fe43 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/syntax.md @@ -0,0 +1,6 @@ +--- +title: Syntax +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/the-command-line.md b/src/pages/learn/programming-fundamentals/the-command-line.md new file mode 100644 index 0000000..689b59f --- /dev/null +++ b/src/pages/learn/programming-fundamentals/the-command-line.md @@ -0,0 +1,6 @@ +--- +title: The Command Line +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/the-do-while-loop.md b/src/pages/learn/programming-fundamentals/the-do-while-loop.md new file mode 100644 index 0000000..6b4fecf --- /dev/null +++ b/src/pages/learn/programming-fundamentals/the-do-while-loop.md @@ -0,0 +1,6 @@ +--- +title: The do while Loop +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/the-else-if-statement.md b/src/pages/learn/programming-fundamentals/the-else-if-statement.md new file mode 100644 index 0000000..dc5df6c --- /dev/null +++ b/src/pages/learn/programming-fundamentals/the-else-if-statement.md @@ -0,0 +1,6 @@ +--- +title: The else if statement +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/the-else-statement.md b/src/pages/learn/programming-fundamentals/the-else-statement.md new file mode 100644 index 0000000..40db28b --- /dev/null +++ b/src/pages/learn/programming-fundamentals/the-else-statement.md @@ -0,0 +1,6 @@ +--- +title: The else Statement +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/the-for-loop.md b/src/pages/learn/programming-fundamentals/the-for-loop.md new file mode 100644 index 0000000..e378f39 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/the-for-loop.md @@ -0,0 +1,6 @@ +--- +title: The for Loop +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/the-if-statement.md b/src/pages/learn/programming-fundamentals/the-if-statement.md new file mode 100644 index 0000000..e593305 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/the-if-statement.md @@ -0,0 +1,6 @@ +--- +title: The if Statement +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/the-switch-statement.md b/src/pages/learn/programming-fundamentals/the-switch-statement.md new file mode 100644 index 0000000..c5784f5 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/the-switch-statement.md @@ -0,0 +1,6 @@ +--- +title: The switch statement +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/the-ternary-operator.md b/src/pages/learn/programming-fundamentals/the-ternary-operator.md new file mode 100644 index 0000000..a7f0f9b --- /dev/null +++ b/src/pages/learn/programming-fundamentals/the-ternary-operator.md @@ -0,0 +1,6 @@ +--- +title: The Ternary Operator +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/the-while-loop.md b/src/pages/learn/programming-fundamentals/the-while-loop.md new file mode 100644 index 0000000..9d99f34 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/the-while-loop.md @@ -0,0 +1,6 @@ +--- +title: The while Loop +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/tracing-recursive-functions.md b/src/pages/learn/programming-fundamentals/tracing-recursive-functions.md new file mode 100644 index 0000000..a6fff8b --- /dev/null +++ b/src/pages/learn/programming-fundamentals/tracing-recursive-functions.md @@ -0,0 +1,6 @@ +--- +title: Tracing recursive functions +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/try-blocks.md b/src/pages/learn/programming-fundamentals/try-blocks.md new file mode 100644 index 0000000..bcb0450 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/try-blocks.md @@ -0,0 +1,6 @@ +--- +title: try Blocks +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/types-of-exceptions.md b/src/pages/learn/programming-fundamentals/types-of-exceptions.md new file mode 100644 index 0000000..bc5acac --- /dev/null +++ b/src/pages/learn/programming-fundamentals/types-of-exceptions.md @@ -0,0 +1,6 @@ +--- +title: Types of Exceptions +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/value-v-reference.md b/src/pages/learn/programming-fundamentals/value-v-reference.md new file mode 100644 index 0000000..3d2bd67 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/value-v-reference.md @@ -0,0 +1,6 @@ +--- +title: Value v Reference +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/variable-assignment.md b/src/pages/learn/programming-fundamentals/variable-assignment.md new file mode 100644 index 0000000..636c012 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/variable-assignment.md @@ -0,0 +1,6 @@ +--- +title: Variable Assignment +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/variables.md b/src/pages/learn/programming-fundamentals/variables.md new file mode 100644 index 0000000..e3516aa --- /dev/null +++ b/src/pages/learn/programming-fundamentals/variables.md @@ -0,0 +1,6 @@ +--- +title: Variables +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/what-are-conditional-statements.md b/src/pages/learn/programming-fundamentals/what-are-conditional-statements.md new file mode 100644 index 0000000..d25cb64 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/what-are-conditional-statements.md @@ -0,0 +1,6 @@ +--- +title: What are conditional statements? +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/what-are-data-types.md b/src/pages/learn/programming-fundamentals/what-are-data-types.md new file mode 100644 index 0000000..e29cf78 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/what-are-data-types.md @@ -0,0 +1,6 @@ +--- +title: What are data types? +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/what-are-loops.md b/src/pages/learn/programming-fundamentals/what-are-loops.md new file mode 100644 index 0000000..bd77d46 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/what-are-loops.md @@ -0,0 +1,6 @@ +--- +title: What are loops? +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/what-is-an-object.md b/src/pages/learn/programming-fundamentals/what-is-an-object.md new file mode 100644 index 0000000..bae6e3b --- /dev/null +++ b/src/pages/learn/programming-fundamentals/what-is-an-object.md @@ -0,0 +1,6 @@ +--- +title: What is an object? +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/what-is-recursion.md b/src/pages/learn/programming-fundamentals/what-is-recursion.md new file mode 100644 index 0000000..728795e --- /dev/null +++ b/src/pages/learn/programming-fundamentals/what-is-recursion.md @@ -0,0 +1,6 @@ +--- +title: What is recursion? +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/what-next.md b/src/pages/learn/programming-fundamentals/what-next.md new file mode 100644 index 0000000..3a801d0 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/what-next.md @@ -0,0 +1,6 @@ +--- +title: What next? +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/why-this-book.md b/src/pages/learn/programming-fundamentals/why-this-book.md new file mode 100644 index 0000000..0c4610c --- /dev/null +++ b/src/pages/learn/programming-fundamentals/why-this-book.md @@ -0,0 +1,6 @@ +--- +title: Why this book? +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/why-use-recursion.md b/src/pages/learn/programming-fundamentals/why-use-recursion.md new file mode 100644 index 0000000..fd0d623 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/why-use-recursion.md @@ -0,0 +1,6 @@ +--- +title: Why use recursion? +layout: '@/layouts/learn.astro' +--- + +TODO: add content diff --git a/src/pages/learn/programming-fundamentals/writing-files.md b/src/pages/learn/programming-fundamentals/writing-files.md new file mode 100644 index 0000000..3d1b850 --- /dev/null +++ b/src/pages/learn/programming-fundamentals/writing-files.md @@ -0,0 +1,6 @@ +--- +title: Writing Files +layout: '@/layouts/learn.astro' +--- + +TODO: add content From 9e03c4bc5f4518de126cfa1024cdaefd4757c752 Mon Sep 17 00:00:00 2001 From: Dustin Goodman Date: Sun, 14 Aug 2022 12:48:49 -0500 Subject: [PATCH 4/8] update page titles and breadcrumbs (#119) * add title to all pages and fix prop accessors * update h1 styles * add CaretRightIcon * fix breadcrumbs and rename getSidebarNav to getNavContent * add breadcrumbs component * update nav component to receive data from parent * update learn layout to generate nav and breadcrumb data * update programming fundamentals nav data for breadcrumbs * fix typo * reorganize programming fundamentals folders * cleanup breadcrumb component * run formatter * fix learn index link --- src/components/Icons/CaretRightIcon.jsx | 19 +++ src/components/Icons/index.jsx | 1 + src/components/Learn/Breadcrumbs.astro | 35 +++++ src/components/Learn/Nav.astro | 10 +- src/layouts/learn.astro | 21 ++- src/navData/programming-fundamentals.json | 126 +++++++++--------- src/pages/learn/index.astro | 4 +- .../index.md} | 0 .../picking-conditional-pattern.md | 0 .../the-else-if-statement.md | 0 .../the-else-statement.md | 0 .../the-if-statement.md | 0 .../the-switch-statement.md | 0 .../the-ternary-operator.md | 0 .../what-are-conditional-statements.md | 0 .../{ => data-types}/arithmetic-operators.md | 0 .../{ => data-types}/arrays.md | 0 .../{ => data-types}/bitwise-operators.md | 0 .../{data-types.md => data-types/index.md} | 0 .../{ => data-types}/logical-operators.md | 0 .../multi-dimensional-arrays.md | 0 .../{ => data-types}/variable-assignment.md | 0 .../{ => data-types}/variables.md | 0 .../{ => data-types}/what-are-data-types.md | 0 .../{ => exception-handling}/catch-blocks.md | 0 .../finally-blocks.md | 0 .../index.md} | 0 .../{ => exception-handling}/try-blocks.md | 0 .../types-of-exceptions.md | 0 .../command-line-interactions.md | 0 .../{ => file-io}/file-permissions.md | 0 .../{ => file-io}/file-streaming.md | 0 .../{file-io.md => file-io/index.md} | 0 .../{ => file-io}/reading-files.md | 0 .../{ => file-io}/writing-files.md | 0 .../debugging.md | 0 .../displaying-output.md | 0 .../errors.md | 0 .../function-parameters.md | 0 .../functional-decomposition.md | 0 .../functions-and-methods.md | 0 .../index.md} | 0 .../return-values.md | 0 .../value-v-reference.md | 0 .../{introduction.md => index.md} | 0 .../compiled-v-interpretted.md | 0 .../{ => introduction}/how-programs-work.md | 0 .../how-to-use-this-book.md | 0 .../{ => introduction}/programming.md | 0 .../styles-of-programming.md | 0 .../{ => introduction}/syntax.md | 0 .../{ => introduction}/the-command-line.md | 0 .../{ => introduction}/why-this-book.md | 0 .../{ => loops}/functional-looping.md | 0 .../{loops.md => loops/index.md} | 0 .../{ => loops}/special-loops.md | 0 .../{ => loops}/the-do-while-loop.md | 0 .../{ => loops}/the-for-loop.md | 0 .../{ => loops}/the-while-loop.md | 0 .../{ => loops}/what-are-loops.md | 0 .../abstract-classes-and-interfaces.md | 0 .../{ => objects}/class-inheritence.md | 0 .../{ => objects}/creating-objects.md | 0 .../{objects.md => objects/index.md} | 0 .../{ => objects}/maps-dictionaries-tables.md | 0 .../{ => objects}/polymorphism.md | 0 .../{ => objects}/what-is-an-object.md | 0 .../converting-recrusion-to-loops.md | 0 .../{recursion.md => recursion/index.md} | 0 .../our-first-recursive-function.md | 0 .../tracing-recursive-functions.md | 0 .../{ => recursion}/what-is-recursion.md | 0 .../{ => recursion}/why-use-recursion.md | 0 .../how-to-use-regular-expressions.md | 0 .../index.md} | 0 .../pattern-matching-and-grouping.md | 0 .../regular-expression-special-tokens.md | 0 .../{what-next.md => whats-next/index.md} | 2 +- src/styles/base.css | 2 +- src/utils/nav.ts | 6 +- 80 files changed, 143 insertions(+), 83 deletions(-) create mode 100644 src/components/Icons/CaretRightIcon.jsx create mode 100644 src/components/Learn/Breadcrumbs.astro rename src/pages/learn/programming-fundamentals/{conditional-statements.md => conditional-statements/index.md} (100%) rename src/pages/learn/programming-fundamentals/{ => conditional-statements}/picking-conditional-pattern.md (100%) rename src/pages/learn/programming-fundamentals/{ => conditional-statements}/the-else-if-statement.md (100%) rename src/pages/learn/programming-fundamentals/{ => conditional-statements}/the-else-statement.md (100%) rename src/pages/learn/programming-fundamentals/{ => conditional-statements}/the-if-statement.md (100%) rename src/pages/learn/programming-fundamentals/{ => conditional-statements}/the-switch-statement.md (100%) rename src/pages/learn/programming-fundamentals/{ => conditional-statements}/the-ternary-operator.md (100%) rename src/pages/learn/programming-fundamentals/{ => conditional-statements}/what-are-conditional-statements.md (100%) rename src/pages/learn/programming-fundamentals/{ => data-types}/arithmetic-operators.md (100%) rename src/pages/learn/programming-fundamentals/{ => data-types}/arrays.md (100%) rename src/pages/learn/programming-fundamentals/{ => data-types}/bitwise-operators.md (100%) rename src/pages/learn/programming-fundamentals/{data-types.md => data-types/index.md} (100%) rename src/pages/learn/programming-fundamentals/{ => data-types}/logical-operators.md (100%) rename src/pages/learn/programming-fundamentals/{ => data-types}/multi-dimensional-arrays.md (100%) rename src/pages/learn/programming-fundamentals/{ => data-types}/variable-assignment.md (100%) rename src/pages/learn/programming-fundamentals/{ => data-types}/variables.md (100%) rename src/pages/learn/programming-fundamentals/{ => data-types}/what-are-data-types.md (100%) rename src/pages/learn/programming-fundamentals/{ => exception-handling}/catch-blocks.md (100%) rename src/pages/learn/programming-fundamentals/{ => exception-handling}/finally-blocks.md (100%) rename src/pages/learn/programming-fundamentals/{exception-handling.md => exception-handling/index.md} (100%) rename src/pages/learn/programming-fundamentals/{ => exception-handling}/try-blocks.md (100%) rename src/pages/learn/programming-fundamentals/{ => exception-handling}/types-of-exceptions.md (100%) rename src/pages/learn/programming-fundamentals/{ => file-io}/command-line-interactions.md (100%) rename src/pages/learn/programming-fundamentals/{ => file-io}/file-permissions.md (100%) rename src/pages/learn/programming-fundamentals/{ => file-io}/file-streaming.md (100%) rename src/pages/learn/programming-fundamentals/{file-io.md => file-io/index.md} (100%) rename src/pages/learn/programming-fundamentals/{ => file-io}/reading-files.md (100%) rename src/pages/learn/programming-fundamentals/{ => file-io}/writing-files.md (100%) rename src/pages/learn/programming-fundamentals/{ => functions-and-running-programs}/debugging.md (100%) rename src/pages/learn/programming-fundamentals/{ => functions-and-running-programs}/displaying-output.md (100%) rename src/pages/learn/programming-fundamentals/{ => functions-and-running-programs}/errors.md (100%) rename src/pages/learn/programming-fundamentals/{ => functions-and-running-programs}/function-parameters.md (100%) rename src/pages/learn/programming-fundamentals/{ => functions-and-running-programs}/functional-decomposition.md (100%) rename src/pages/learn/programming-fundamentals/{ => functions-and-running-programs}/functions-and-methods.md (100%) rename src/pages/learn/programming-fundamentals/{functions-and-running-programs.md => functions-and-running-programs/index.md} (100%) rename src/pages/learn/programming-fundamentals/{ => functions-and-running-programs}/return-values.md (100%) rename src/pages/learn/programming-fundamentals/{ => functions-and-running-programs}/value-v-reference.md (100%) rename src/pages/learn/programming-fundamentals/{introduction.md => index.md} (100%) rename src/pages/learn/programming-fundamentals/{ => introduction}/compiled-v-interpretted.md (100%) rename src/pages/learn/programming-fundamentals/{ => introduction}/how-programs-work.md (100%) rename src/pages/learn/programming-fundamentals/{ => introduction}/how-to-use-this-book.md (100%) rename src/pages/learn/programming-fundamentals/{ => introduction}/programming.md (100%) rename src/pages/learn/programming-fundamentals/{ => introduction}/styles-of-programming.md (100%) rename src/pages/learn/programming-fundamentals/{ => introduction}/syntax.md (100%) rename src/pages/learn/programming-fundamentals/{ => introduction}/the-command-line.md (100%) rename src/pages/learn/programming-fundamentals/{ => introduction}/why-this-book.md (100%) rename src/pages/learn/programming-fundamentals/{ => loops}/functional-looping.md (100%) rename src/pages/learn/programming-fundamentals/{loops.md => loops/index.md} (100%) rename src/pages/learn/programming-fundamentals/{ => loops}/special-loops.md (100%) rename src/pages/learn/programming-fundamentals/{ => loops}/the-do-while-loop.md (100%) rename src/pages/learn/programming-fundamentals/{ => loops}/the-for-loop.md (100%) rename src/pages/learn/programming-fundamentals/{ => loops}/the-while-loop.md (100%) rename src/pages/learn/programming-fundamentals/{ => loops}/what-are-loops.md (100%) rename src/pages/learn/programming-fundamentals/{ => objects}/abstract-classes-and-interfaces.md (100%) rename src/pages/learn/programming-fundamentals/{ => objects}/class-inheritence.md (100%) rename src/pages/learn/programming-fundamentals/{ => objects}/creating-objects.md (100%) rename src/pages/learn/programming-fundamentals/{objects.md => objects/index.md} (100%) rename src/pages/learn/programming-fundamentals/{ => objects}/maps-dictionaries-tables.md (100%) rename src/pages/learn/programming-fundamentals/{ => objects}/polymorphism.md (100%) rename src/pages/learn/programming-fundamentals/{ => objects}/what-is-an-object.md (100%) rename src/pages/learn/programming-fundamentals/{ => recursion}/converting-recrusion-to-loops.md (100%) rename src/pages/learn/programming-fundamentals/{recursion.md => recursion/index.md} (100%) rename src/pages/learn/programming-fundamentals/{ => recursion}/our-first-recursive-function.md (100%) rename src/pages/learn/programming-fundamentals/{ => recursion}/tracing-recursive-functions.md (100%) rename src/pages/learn/programming-fundamentals/{ => recursion}/what-is-recursion.md (100%) rename src/pages/learn/programming-fundamentals/{ => recursion}/why-use-recursion.md (100%) rename src/pages/learn/programming-fundamentals/{ => regular-expressions}/how-to-use-regular-expressions.md (100%) rename src/pages/learn/programming-fundamentals/{regular-expressions.md => regular-expressions/index.md} (100%) rename src/pages/learn/programming-fundamentals/{ => regular-expressions}/pattern-matching-and-grouping.md (100%) rename src/pages/learn/programming-fundamentals/{ => regular-expressions}/regular-expression-special-tokens.md (100%) rename src/pages/learn/programming-fundamentals/{what-next.md => whats-next/index.md} (74%) diff --git a/src/components/Icons/CaretRightIcon.jsx b/src/components/Icons/CaretRightIcon.jsx new file mode 100644 index 0000000..ffc4b3b --- /dev/null +++ b/src/components/Icons/CaretRightIcon.jsx @@ -0,0 +1,19 @@ +function CaretRightIcon({ className = '' }) { + return ( + + + + ); +} + +export default CaretRightIcon; diff --git a/src/components/Icons/index.jsx b/src/components/Icons/index.jsx index f42bcf1..86befba 100644 --- a/src/components/Icons/index.jsx +++ b/src/components/Icons/index.jsx @@ -1,3 +1,4 @@ +export { default as CaretRightIcon } from './CaretRightIcon'; export { default as CloseIcon } from './CloseIcon'; export { default as CodeIcon } from './CodeIcon'; export { default as DevToIcon } from './DevToIcon'; diff --git a/src/components/Learn/Breadcrumbs.astro b/src/components/Learn/Breadcrumbs.astro new file mode 100644 index 0000000..2cf9eb7 --- /dev/null +++ b/src/components/Learn/Breadcrumbs.astro @@ -0,0 +1,35 @@ +--- +import { RouteItem } from '@/utils/nav'; +import { CaretRightIcon } from '@/components/Icons'; + +export interface Props { + breadcrumbs: RouteItem[]; +} + +const { breadcrumbs } = Astro.props as Props; +--- + +
+ { + breadcrumbs.map((crumb) => { + if (!crumb.path) { + return null; + } + return ( +
+ <> + + {crumb.title} + + + + + +
+ ); + }) + } +
diff --git a/src/components/Learn/Nav.astro b/src/components/Learn/Nav.astro index c54da74..6d26788 100644 --- a/src/components/Learn/Nav.astro +++ b/src/components/Learn/Nav.astro @@ -1,14 +1,12 @@ --- -import { getSidebarNav, getRouteInfo } from '@/utils/nav'; +import { RouteItem } from '@/utils/nav'; export interface Props { - currentPage: string; + navContent: RouteItem; } -const { currentPage } = Astro.props as Props; -const sidebarNav = getSidebarNav(currentPage); -const navPaths = sidebarNav.routes; -const routeInfo = getRouteInfo(sidebarNav, currentPage); +const { navContent } = Astro.props as Props; +const navPaths = navContent.routes; ---