Browse Source

Fixes wrong breadcrumb for 404 page (#4074)

* Fixes wrong breadcrumb for 404 page

* Change Home as default layout

* Add layout Learn to the pages inside learn
main
harish-sethuraman 3 years ago
committed by GitHub
parent
commit
8333b6d127
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      beta/plugins/md-layout-loader.js
  2. 5
      beta/src/components/Layout/useRouteMeta.tsx
  3. 1
      beta/src/pages/learn/add-react-to-a-website.md
  4. 1
      beta/src/pages/learn/adding-interactivity.md
  5. 1
      beta/src/pages/learn/choosing-the-state-structure.md
  6. 1
      beta/src/pages/learn/conditional-rendering.md
  7. 1
      beta/src/pages/learn/describing-the-ui.md
  8. 1
      beta/src/pages/learn/editor-setup.md
  9. 1
      beta/src/pages/learn/escape-hatches.md
  10. 1
      beta/src/pages/learn/extracting-state-logic-into-a-reducer.md
  11. 1
      beta/src/pages/learn/importing-and-exporting-components.md
  12. 1
      beta/src/pages/learn/index.md
  13. 1
      beta/src/pages/learn/installation.md
  14. 1
      beta/src/pages/learn/javascript-in-jsx-with-curly-braces.md
  15. 1
      beta/src/pages/learn/keeping-components-pure.md
  16. 1
      beta/src/pages/learn/managing-state.md
  17. 1
      beta/src/pages/learn/manipulating-the-dom-with-refs.md
  18. 1
      beta/src/pages/learn/passing-data-deeply-with-context.md
  19. 1
      beta/src/pages/learn/passing-props-to-a-component.md
  20. 1
      beta/src/pages/learn/preserving-and-resetting-state.md
  21. 1
      beta/src/pages/learn/queueing-a-series-of-state-updates.md
  22. 1
      beta/src/pages/learn/react-developer-tools.md
  23. 1
      beta/src/pages/learn/reacting-to-input-with-state.md
  24. 1
      beta/src/pages/learn/referencing-values-with-refs.md
  25. 1
      beta/src/pages/learn/render-and-commit.md
  26. 1
      beta/src/pages/learn/rendering-lists.md
  27. 1
      beta/src/pages/learn/responding-to-events.md
  28. 1
      beta/src/pages/learn/scaling-up-with-reducer-and-context.md
  29. 1
      beta/src/pages/learn/sharing-state-between-components.md
  30. 1
      beta/src/pages/learn/start-a-new-react-project.md
  31. 1
      beta/src/pages/learn/state-a-components-memory.md
  32. 1
      beta/src/pages/learn/state-as-a-snapshot.md
  33. 1
      beta/src/pages/learn/thinking-in-react.md
  34. 1
      beta/src/pages/learn/updating-arrays-in-state.md
  35. 1
      beta/src/pages/learn/updating-objects-in-state.md
  36. 1
      beta/src/pages/learn/writing-markup-with-jsx.md
  37. 1
      beta/src/pages/learn/your-first-component.md

2
beta/plugins/md-layout-loader.js

@ -15,7 +15,7 @@ const fm = require('gray-matter');
module.exports = async function (src) {
const callback = this.async();
const {content, data} = fm(src);
const layout = data.layout || 'Learn';
const layout = data.layout || 'Home';
const code =
`import withLayout from 'components/Layout/Layout${layout}';

5
beta/src/components/Layout/useRouteMeta.tsx

@ -56,6 +56,11 @@ export function useRouteMeta(rootRoute?: RouteItem) {
const routeTree = rootRoute || sidebarContext;
const router = useRouter();
const cleanedPath = router.pathname;
if (cleanedPath === '/404') {
return {
breadcrumbs: [],
};
}
const breadcrumbs = getBreadcrumbs(cleanedPath, routeTree);
return {
...getRouteMeta(cleanedPath, routeTree),

1
beta/src/pages/learn/add-react-to-a-website.md

@ -1,5 +1,6 @@
---
title: Add React to a Website
layout: Learn
---
<Intro>

1
beta/src/pages/learn/adding-interactivity.md

@ -1,5 +1,6 @@
---
title: Adding Interactivity
layout: Learn
---
<Intro>

1
beta/src/pages/learn/choosing-the-state-structure.md

@ -1,5 +1,6 @@
---
title: Choosing the State Structure
layout: Learn
---
<Intro>

1
beta/src/pages/learn/conditional-rendering.md

@ -1,5 +1,6 @@
---
title: Conditional Rendering
layout: Learn
---
<Intro>

1
beta/src/pages/learn/describing-the-ui.md

@ -1,5 +1,6 @@
---
title: Describing the UI
layout: Learn
---
<Intro>

1
beta/src/pages/learn/editor-setup.md

@ -1,5 +1,6 @@
---
title: Editor Setup
layout: Learn
---
<Intro>

1
beta/src/pages/learn/escape-hatches.md

@ -1,5 +1,6 @@
---
title: Escape Hatches
layout: Learn
---
This chapter is incomplete and is still being written!

1
beta/src/pages/learn/extracting-state-logic-into-a-reducer.md

@ -1,5 +1,6 @@
---
title: Extracting State Logic into a Reducer
layout: Learn
---
<Intro>

1
beta/src/pages/learn/importing-and-exporting-components.md

@ -1,5 +1,6 @@
---
title: Importing and Exporting Components
layout: Learn
---
<Intro>

1
beta/src/pages/learn/index.md

@ -1,5 +1,6 @@
---
title: Quick Start
layout: Learn
---
<Intro>

1
beta/src/pages/learn/installation.md

@ -1,5 +1,6 @@
---
title: Installation
layout: Learn
---
<Intro>

1
beta/src/pages/learn/javascript-in-jsx-with-curly-braces.md

@ -1,5 +1,6 @@
---
title: JavaScript in JSX with Curly Braces
layout: Learn
---
<Intro>

1
beta/src/pages/learn/keeping-components-pure.md

@ -1,5 +1,6 @@
---
title: Keeping Components Pure
layout: Learn
---
<Intro>

1
beta/src/pages/learn/managing-state.md

@ -1,5 +1,6 @@
---
title: Managing State
layout: Learn
---
<Intro>

1
beta/src/pages/learn/manipulating-the-dom-with-refs.md

@ -1,5 +1,6 @@
---
title: 'Manipulating the DOM with Refs'
layout: Learn
---
<Intro>

1
beta/src/pages/learn/passing-data-deeply-with-context.md

@ -1,5 +1,6 @@
---
title: Passing Data Deeply with Context
layout: Learn
---
<Intro>

1
beta/src/pages/learn/passing-props-to-a-component.md

@ -1,5 +1,6 @@
---
title: Passing Props to a Component
layout: Learn
---
<Intro>

1
beta/src/pages/learn/preserving-and-resetting-state.md

@ -1,5 +1,6 @@
---
title: Preserving and Resetting State
layout: Learn
---
<Intro>

1
beta/src/pages/learn/queueing-a-series-of-state-updates.md

@ -1,5 +1,6 @@
---
title: Queueing a Series of State Updates
layout: Learn
---
<Intro>

1
beta/src/pages/learn/react-developer-tools.md

@ -1,5 +1,6 @@
---
title: React Developer Tools
layout: Learn
---
<Intro>

1
beta/src/pages/learn/reacting-to-input-with-state.md

@ -1,5 +1,6 @@
---
title: Reacting to Input with State
layout: Learn
---
<Intro>

1
beta/src/pages/learn/referencing-values-with-refs.md

@ -1,5 +1,6 @@
---
title: 'Referencing Values with Refs'
layout: Learn
---
<Intro>

1
beta/src/pages/learn/render-and-commit.md

@ -1,5 +1,6 @@
---
title: Render and Commit
layout: Learn
---
<Intro>

1
beta/src/pages/learn/rendering-lists.md

@ -1,5 +1,6 @@
---
title: Rendering Lists
layout: Learn
---
<Intro>

1
beta/src/pages/learn/responding-to-events.md

@ -1,5 +1,6 @@
---
title: Responding to Events
layout: Learn
---
<Intro>

1
beta/src/pages/learn/scaling-up-with-reducer-and-context.md

@ -1,5 +1,6 @@
---
title: Scaling Up with Reducer and Context
layout: Learn
---
<Intro>

1
beta/src/pages/learn/sharing-state-between-components.md

@ -1,5 +1,6 @@
---
title: Sharing State Between Components
layout: Learn
---
<Intro>

1
beta/src/pages/learn/start-a-new-react-project.md

@ -1,5 +1,6 @@
---
title: Start a New React Project
layout: Learn
---
<Intro>

1
beta/src/pages/learn/state-a-components-memory.md

@ -1,5 +1,6 @@
---
title: "State: A Component's Memory"
layout: Learn
---
<Intro>

1
beta/src/pages/learn/state-as-a-snapshot.md

@ -1,5 +1,6 @@
---
title: State as a Snapshot
layout: Learn
---
<Intro>

1
beta/src/pages/learn/thinking-in-react.md

@ -1,5 +1,6 @@
---
title: Thinking in React
layout: Learn
---
<Intro>

1
beta/src/pages/learn/updating-arrays-in-state.md

@ -1,5 +1,6 @@
---
title: Updating Arrays in State
layout: Learn
---
<Intro>

1
beta/src/pages/learn/updating-objects-in-state.md

@ -1,5 +1,6 @@
---
title: Updating Objects in State
layout: Learn
---
<Intro>

1
beta/src/pages/learn/writing-markup-with-jsx.md

@ -1,5 +1,6 @@
---
title: Writing Markup with JSX
layout: Learn
---
<Intro>

1
beta/src/pages/learn/your-first-component.md

@ -1,5 +1,6 @@
---
title: Your First Component
layout: Learn
---
<Intro>

Loading…
Cancel
Save