-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Page per section upgraded with page not found #993
Merged
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
04e36e6
Feat: Added exampleModes and usageModes settings per sections
rafaesc fd8f119
Test: Updated snap
rafaesc 039cfcf
Fix: Support showCode and showUsage
rafaesc 2f5431c
Fix: Name correction and updated config
rafaesc 5b8144e
Feat: pagePerSection updated with sectionDepth
rafaesc 1afcd5e
Fix: sectionDepth is validated only in the first depth
rafaesc e3c0c97
Feat: Added not found page
rafaesc e61caf1
Feat: Added links in .md examples
rafaesc d0a0a0c
Test: Added tests
rafaesc fa145b3
Test: Added getUrl tests
rafaesc a1f3903
Revert "Test: Added getUrl tests"
rafaesc ad5b8b2
Fix: Updated with reviews
rafaesc 393f910
Docs: Added pagePerSection docs
rafaesc e0842ff
Fix: code review of page per sections
rafaesc aa34bfe
Doc: Updated of according code reviews
rafaesc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Tempor qui ad ad sint nulla sint magna aliquip qui ex. Non commodo mollit et exercitation nostrud esse. Minim aliqua cillum est amet dolore ipsum qui tempor eu ea. | ||
|
||
Ut veniam sit pariatur deserunt non officia. Esse commodo proident quis culpa esse enim occaecat occaecat laborum nostrud non non sunt. Labore incididunt reprehenderit sunt elit reprehenderit nulla nulla Lorem aliquip incididunt. Qui cillum consectetur Lorem anim amet ex magna deserunt sunt. | ||
|
||
List of components: | ||
|
||
* [Buttons](#/Components?id=buttons) | ||
* [Fields](#/Components?id=fields) | ||
* [Others](#/Components?id=others) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Excepteur ullamco ut ea laborum in duis fugiat in dolor minim non. Minim amet velit duis fugiat nisi excepteur occaecat elit exercitation eiusmod est aute nulla. Et deserunt labore consectetur elit nostrud consequat commodo occaecat consectetur mollit sunt. Eiusmod laboris incididunt consectetur nisi nulla cupidatat. Velit consequat voluptate eiusmod aliqua esse culpa tempor quis tempor dolor dolor irure. | ||
|
||
Proident laboris esse do culpa ullamco proident deserunt minim nostrud et ut deserunt. Pariatur cillum et nulla labore proident nisi eu veniam. Nulla aute non incididunt laboris dolor magna laborum eu incididunt est. | ||
|
||
Ut culpa non sint eiusmod ut duis. Cillum consequat labore cupidatat eiusmod aute aute. Minim irure labore ea cillum id consectetur incididunt ex tempor deserunt labore. Officia deserunt consequat cupidatat nulla quis aute. Enim laborum aliquip aliquip sit exercitation sint eiusmod do do. Irure esse aliqua veniam do laborum cillum dolor nulla laborum consequat velit amet. Mollit ullamco incididunt Lorem dolor ut qui sunt proident. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Qui adipisicing officia voluptate cillum duis magna eu esse. Officia velit do tempor veniam exercitation ullamco irure. Reprehenderit laborum aliquip ipsum dolore ullamco. Consequat irure commodo culpa id nostrud. Aute et officia esse cillum amet commodo consequat nulla amet aute sint elit proident. Incididunt sunt tempor in ullamco ea eiusmod quis mollit occaecat ea. Sint minim eu mollit occaecat cupidatat velit sunt aliqua reprehenderit do minim anim magna dolore. | ||
|
||
Aute fugiat nulla eu cillum dolore proident eu nisi sint minim veniam. Sunt velit aliqua ullamco quis qui sint aliqua incididunt irure dolor sint nulla commodo qui. Eu nisi pariatur Lorem dolore id aute occaecat adipisicing. Consectetur cupidatat magna magna aute anim eu non officia Lorem esse. Pariatur exercitation id velit anim id laborum dolore laboris esse est in anim dolor. Aute ea in et laboris culpa voluptate laboris ipsum nisi. | ||
|
||
List of files: | ||
|
||
* [First File](#/Documentation/Files/First%20File) | ||
* [Second File](#/Documentation/Files/Second%20File) | ||
* [WrappedButton](#/Documentation/Files/WrappedButton) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,11 @@ const examplesLoader = path.resolve(__dirname, '../examples-loader.js'); | |
* | ||
* @param {Array} sections | ||
* @param {object} config | ||
* @param {number} sectionDepth | ||
* @returns {Array} | ||
*/ | ||
function getSections(sections, config) { | ||
return sections.map(section => processSection(section, config)); | ||
function getSections(sections, config, sectionDepth = 0) { | ||
return sections.map(section => processSection(section, config, sectionDepth, true)); | ||
} | ||
|
||
const getSectionComponents = (section, config) => { | ||
|
@@ -34,9 +35,11 @@ const getSectionComponents = (section, config) => { | |
* Return an object for a given section with all components and subsections. | ||
* @param {object} section | ||
* @param {object} config | ||
* @param {number} sectionDepth | ||
* @param {boolean} firstDepth | ||
* @returns {object} | ||
*/ | ||
function processSection(section, config) { | ||
function processSection(section, config, sectionDepth = 0, firstDepth = false) { | ||
const contentRelativePath = section.content; | ||
|
||
// Try to load section content file | ||
|
@@ -48,12 +51,19 @@ function processSection(section, config) { | |
} | ||
content = requireIt(`!!${examplesLoader}!${contentAbsolutePath}`); | ||
} | ||
sectionDepth = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs some explanation: what is happening here? What is |
||
section.sectionDepth !== undefined && firstDepth ? section.sectionDepth : sectionDepth; | ||
|
||
const childrenSectionDepth = sectionDepth === 0 ? sectionDepth : sectionDepth - 1; | ||
|
||
return { | ||
name: section.name, | ||
exampleMode: section.exampleMode || config.exampleMode, | ||
usageMode: section.usageMode || config.usageMode, | ||
sectionDepth, | ||
description: section.description, | ||
slug: slugger.slug(section.name), | ||
sections: getSections(section.sections || [], config), | ||
sections: getSections(section.sections || [], config, childrenSectionDepth), | ||
filepath: contentRelativePath, | ||
components: getSectionComponents(section, config), | ||
content, | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what that means ;-(