From c72dc046dffda7d8b056623602c80bac3dd6a8f4 Mon Sep 17 00:00:00 2001 From: Claudio W Date: Mon, 30 Oct 2023 12:48:55 +0100 Subject: [PATCH] feat: add learn content to the node.js website (#6064) * feat: sidenav support recursive items * feat: added learn layout * feat: added learn navigation * feat: added new translation ids * feat: mark docs as archive * chore: improved styles, use grid system * feat: added learn pages, removed duplicated/outdated guides * chore: added images * meta: crowdin no translations for learn * chore: updated redirects * meta: no need of package-name for private package * Apply suggestions from code review Co-authored-by: canerakdas Signed-off-by: Claudio W * style: use flexboxes * chore: self-code-review and adjustments --------- Signed-off-by: Claudio W Co-authored-by: canerakdas --- components/SideNavigation.tsx | 18 +- crowdin.yml | 2 + hooks/useNavigation.tsx | 33 +- i18n/locales/ar.json | 39 +- i18n/locales/de.json | 39 +- i18n/locales/en.json | 39 +- i18n/locales/es.json | 39 +- i18n/locales/fr.json | 39 +- i18n/locales/id.json | 39 +- i18n/locales/it.json | 39 +- i18n/locales/ja.json | 39 +- i18n/locales/ka.json | 39 +- i18n/locales/ko.json | 39 +- i18n/locales/pt-br.json | 39 +- i18n/locales/ru.json | 39 +- i18n/locales/tr.json | 39 +- i18n/locales/uk.json | 39 +- i18n/locales/zh-cn.json | 39 +- i18n/locales/zh-tw.json | 39 +- layouts/DocsLayout.tsx | 3 + layouts/LearnLayout.tsx | 16 + navigation.json | 142 ++++++ package-lock.json | 1 - package.json | 1 - .../guides/buffer-constructor-deprecation.md | 280 ----------- pages/en/docs/guides/domain-postmortem.md | 466 ------------------ pages/en/docs/guides/getting-started-guide.md | 32 -- pages/en/docs/guides/index.md | 8 +- pages/en/docs/guides/nodejs-docker-webapp.md | 289 ----------- pages/en/docs/guides/timers-in-node.md | 194 -------- .../asynchronous-flow-control.md | 271 ++++++++++ .../discover-javascript-timers.md | 135 +++++ ...-asynchronous-programming-and-callbacks.md | 134 +++++ .../overview-of-blocking-vs-non-blocking.md} | 11 +- .../the-nodejs-event-emitter.md | 70 +++ .../understanding-processnexttick.md | 52 ++ .../understanding-setimmediate.md | 53 ++ ...t-input-from-the-command-line-in-nodejs.md | 59 +++ ...-read-environment-variables-from-nodejs.md | 49 ++ .../how-to-use-the-nodejs-repl.md | 152 ++++++ ...output-to-the-command-line-using-nodejs.md | 209 ++++++++ ...un-nodejs-scripts-from-the-command-line.md | 71 +++ ...introduction-to-the-npm-package-manager.md | 131 +++++ ...ferences-between-nodejs-and-the-browser.md | 27 + .../ecmascript-2015-es6-and-beyond.md | 41 ++ ...cript-do-you-need-to-know-to-use-nodejs.md | 39 ++ .../getting-started/how-to-install-nodejs.md | 17 + .../getting-started/introduction-to-nodejs.md | 84 ++++ ...ence-between-development-and-production.md | 63 +++ .../getting-started/nodejs-with-typescript.md | 132 +++++ .../nodejs-with-webassembly.md | 69 +++ .../the-v8-javascript-engine.md | 51 ++ pages/en/learn/index.md | 46 ++ .../manipulating-files/nodejs-file-paths.md | 72 +++ .../manipulating-files/nodejs-file-stats.md | 81 +++ .../reading-files-with-nodejs.md | 56 +++ ...working-with-file-descriptors-in-nodejs.md | 102 ++++ .../working-with-folders-in-nodejs.md | 141 ++++++ .../writing-files-with-nodejs.md | 115 +++++ providers/layoutProvider.tsx | 3 + .../recursive-settimeout.png | Bin 0 -> 3417 bytes .../javascript-timers/setinterval-ok.png | Bin 0 -> 3215 bytes .../setinterval-overlapping.png | Bin 0 -> 3404 bytes .../setinterval-varying-duration.png | Bin 0 -> 3266 bytes redirects.json | 12 + styles/old/index.css | 102 ++-- styles/old/layout/grid.css | 1 - styles/old/layout/main.css | 21 +- types/layouts.ts | 2 +- types/navigation.ts | 1 + 70 files changed, 3390 insertions(+), 1394 deletions(-) create mode 100644 layouts/LearnLayout.tsx delete mode 100644 pages/en/docs/guides/buffer-constructor-deprecation.md delete mode 100644 pages/en/docs/guides/domain-postmortem.md delete mode 100644 pages/en/docs/guides/getting-started-guide.md delete mode 100644 pages/en/docs/guides/nodejs-docker-webapp.md delete mode 100644 pages/en/docs/guides/timers-in-node.md create mode 100644 pages/en/learn/asynchronous-work/asynchronous-flow-control.md create mode 100644 pages/en/learn/asynchronous-work/discover-javascript-timers.md create mode 100644 pages/en/learn/asynchronous-work/javascript-asynchronous-programming-and-callbacks.md rename pages/en/{docs/guides/blocking-vs-non-blocking.md => learn/asynchronous-work/overview-of-blocking-vs-non-blocking.md} (96%) create mode 100644 pages/en/learn/asynchronous-work/the-nodejs-event-emitter.md create mode 100644 pages/en/learn/asynchronous-work/understanding-processnexttick.md create mode 100644 pages/en/learn/asynchronous-work/understanding-setimmediate.md create mode 100644 pages/en/learn/command-line/accept-input-from-the-command-line-in-nodejs.md create mode 100644 pages/en/learn/command-line/how-to-read-environment-variables-from-nodejs.md create mode 100644 pages/en/learn/command-line/how-to-use-the-nodejs-repl.md create mode 100644 pages/en/learn/command-line/output-to-the-command-line-using-nodejs.md create mode 100644 pages/en/learn/command-line/run-nodejs-scripts-from-the-command-line.md create mode 100644 pages/en/learn/getting-started/an-introduction-to-the-npm-package-manager.md create mode 100644 pages/en/learn/getting-started/differences-between-nodejs-and-the-browser.md create mode 100644 pages/en/learn/getting-started/ecmascript-2015-es6-and-beyond.md create mode 100644 pages/en/learn/getting-started/how-much-javascript-do-you-need-to-know-to-use-nodejs.md create mode 100644 pages/en/learn/getting-started/how-to-install-nodejs.md create mode 100644 pages/en/learn/getting-started/introduction-to-nodejs.md create mode 100644 pages/en/learn/getting-started/nodejs-the-difference-between-development-and-production.md create mode 100644 pages/en/learn/getting-started/nodejs-with-typescript.md create mode 100644 pages/en/learn/getting-started/nodejs-with-webassembly.md create mode 100644 pages/en/learn/getting-started/the-v8-javascript-engine.md create mode 100644 pages/en/learn/index.md create mode 100644 pages/en/learn/manipulating-files/nodejs-file-paths.md create mode 100644 pages/en/learn/manipulating-files/nodejs-file-stats.md create mode 100644 pages/en/learn/manipulating-files/reading-files-with-nodejs.md create mode 100644 pages/en/learn/manipulating-files/working-with-file-descriptors-in-nodejs.md create mode 100644 pages/en/learn/manipulating-files/working-with-folders-in-nodejs.md create mode 100644 pages/en/learn/manipulating-files/writing-files-with-nodejs.md create mode 100644 public/static/images/learn/javascript-timers/recursive-settimeout.png create mode 100644 public/static/images/learn/javascript-timers/setinterval-ok.png create mode 100644 public/static/images/learn/javascript-timers/setinterval-overlapping.png create mode 100644 public/static/images/learn/javascript-timers/setinterval-varying-duration.png diff --git a/components/SideNavigation.tsx b/components/SideNavigation.tsx index 7aa43aadf0668..e17549fc77c8d 100644 --- a/components/SideNavigation.tsx +++ b/components/SideNavigation.tsx @@ -21,15 +21,25 @@ const SideNavigation: FC = ({ const sideNavigationItems = getSideNavigation(navigationKey, context); - const getLinkClassName = (href: string) => - classNames({ active: isCurrentLocaleRoute(href) }); + const getLinkClasses = (href: string, level: number) => + classNames({ active: isCurrentLocaleRoute(href), level }); return (