Skip to content

Commit eaaed83

Browse files
author
Artem Sapegin
committed
Revert "Feat: Merge branch 'feat-page-per-section'"
This reverts commit 200debf, reversing changes made to 3bbe4f9.
1 parent 200debf commit eaaed83

File tree

61 files changed

+751
-1298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+751
-1298
lines changed

docs/Components.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ Each section consists of (all fields are optional):
109109
* `components` — a glob pattern string, an array of component paths or a function returning a list of components. The same rules apply as for the root `components` option.
110110
* `sections` — array of subsections (can be nested).
111111
* `description` — A small description of this section.
112-
* `sectionDepth` — Number of subsections with single pages, only available with [pagePerSection](Configuration.md#pagepersection) is enabled.
113-
* `exampleMode` — Initial state of the code example tab, uses [exampleMode](Configuration.md#examplemode).
114-
* `usageMode` — Initial state of the props and methods tab, uses [usageMode](Configuration.md#usagemode).
115112
* `ignore` — string/array of globs that should not be included in the section.
116113

117114
Configuring a style guide with textual documentation section and a list of components would look like:
@@ -140,9 +137,7 @@ module.exports = {
140137
{
141138
name: 'UI Components',
142139
content: 'docs/ui.md',
143-
components: 'lib/components/ui/*.js',
144-
exampleMode: 'expand', // 'hide' | 'collapse' | 'expand'
145-
usageMode: 'expand' // 'hide' | 'collapse' | 'expand'
140+
components: 'lib/components/ui/*.js'
146141
}
147142
]
148143
}

docs/Configuration.md

Lines changed: 15 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ By default, Styleguidist will look for `styleguide.config.js` file in your proje
1515
* [`dangerouslyUpdateWebpackConfig`](#dangerouslyupdatewebpackconfig)
1616
* [`defaultExample`](#defaultexample)
1717
* [`editorConfig`](#editorconfig)
18-
* [`exampleMode`](#examplemode)
1918
* [`getComponentPathLine`](#getcomponentpathline)
2019
* [`getExampleFilename`](#getexamplefilename)
2120
* [`handlers`](#handlers)
@@ -32,6 +31,8 @@ By default, Styleguidist will look for `styleguide.config.js` file in your proje
3231
* [`sections`](#sections)
3332
* [`serverHost`](#serverhost)
3433
* [`serverPort`](#serverport)
34+
* [`showCode`](#showcode)
35+
* [`showUsage`](#showusage)
3536
* [`showSidebar`](#showsidebar)
3637
* [`skipComponentsWithoutExample`](#skipcomponentswithoutexample)
3738
* [`sortProps`](#sortprops)
@@ -43,7 +44,6 @@ By default, Styleguidist will look for `styleguide.config.js` file in your proje
4344
* [`title`](#title)
4445
* [`updateDocs`](#updatedocs)
4546
* [`updateExample`](#updateexample)
46-
* [`usageMode`](#usagemode)
4747
* [`verbose`](#verbose)
4848
* [`webpackConfig`](#webpackconfig)
4949

@@ -197,16 +197,6 @@ module.exports = {
197197
}
198198
```
199199

200-
#### `exampleMode`
201-
202-
Type: `String`, default: `collapse`
203-
204-
Defines the initial state of the example code tab:
205-
206-
* `collapse`: collapses the tab by default.
207-
* `hide`: hide the tab and it can´t be toggled in the UI.
208-
* `expand`: expand the tab by default.
209-
210200
#### `handlers`
211201

212202
Type: `Function`, optional, default: [[react-docgen-displayname-handler](https://github.com/nerdlabs/react-docgen-displayname-handler)]
@@ -282,7 +272,7 @@ Type: `Boolean`, default: `false`
282272

283273
Render one section or component per page, starting with the first.
284274

285-
If set to `true`, each section will be single page.
275+
If set to `true`, the sidebar will be visible on each page, except for the examples.
286276

287277
The value may be differ on each environment.
288278

@@ -292,63 +282,6 @@ module.exports = {
292282
}
293283
```
294284

295-
If you want to isolate section's children as single pages (sub-routes), you can add `sectionDepth` in each section, which it is the number sub-routes for depth that it will have.
296-
297-
For example:
298-
299-
```javascript
300-
module.exports = {
301-
pagePerSection: true,
302-
sections: [
303-
{
304-
name: 'Documentation',
305-
sections: [
306-
{
307-
name: 'Files',
308-
sections: [
309-
{
310-
name: 'First File'
311-
},
312-
{
313-
name: 'Second File'
314-
}
315-
]
316-
}
317-
],
318-
sectionDepth: 2 // It will show "Documentation" and "Files" as single pages, filtering his children.
319-
},
320-
{
321-
name: 'Components',
322-
sections: [
323-
{
324-
name: 'Buttons',
325-
sections: [
326-
{
327-
name: 'WrapperButton'
328-
}
329-
]
330-
}
331-
]
332-
sectionDepth: 1, // It will show "Components" as single page, filtering his children.
333-
},
334-
{
335-
name: 'Examples',
336-
sections: [
337-
{
338-
name: 'Case 1',
339-
sections: [
340-
{
341-
name: 'Buttons'
342-
}
343-
]
344-
}
345-
]
346-
sectionDepth: 0, // There is not sub-routes, "Examples" will be show all his children on page.
347-
}
348-
]
349-
}
350-
```
351-
352285
#### `printBuildInstructions`
353286

354287
Type: `Function`, optional
@@ -486,6 +419,18 @@ Type: `Number`, default: `process.env.NODE_ENV` or `6060`
486419

487420
Dev server port.
488421

422+
#### `showCode`
423+
424+
Type: `Boolean`, default: `false`
425+
426+
Show or hide example code initially. It can be toggled in the UI by clicking the Code button after each example.
427+
428+
#### `showUsage`
429+
430+
Type: `Boolean`, default: `false`
431+
432+
Show or hide props and methods documentation initially. It can be toggled in the UI by clicking the Props & methods button after each component description.
433+
489434
#### `showSidebar`
490435

491436
Type: `Boolean`, default: `true`
@@ -645,16 +590,6 @@ module.exports = {
645590
}
646591
```
647592

648-
#### `usageMode`
649-
650-
Type: `String`, default: `collapse`
651-
652-
Defines the initial state of the props and methods tab:
653-
654-
* `collapse`: collapses the tab by default.
655-
* `hide`: hide the tab and it can´t be toggled in the UI.
656-
* `expand`: expand the tab by default.
657-
658593
Use it like this in your Markdown files:
659594

660595
```js { "file": "./some/file.js" }

examples/sections/docs/Components.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

examples/sections/docs/Documentation.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/sections/docs/Files.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

examples/sections/styleguide.config.js

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ module.exports = {
66
sections: [
77
{
88
name: 'Documentation',
9-
content: 'docs/Documentation.md',
109
sections: [
1110
{
1211
name: 'Files',
13-
content: 'docs/Files.md',
14-
components: () => ['./src/components/WrappedButton/WrappedButton.js'],
1512
sections: [
1613
{
1714
name: 'First File',
1815
content: 'docs/One.md',
1916
description: 'This is the first section description',
20-
components: () => ['./src/components/Label/Label.js'],
2117
},
2218
{
2319
name: 'Second File',
@@ -26,32 +22,26 @@ module.exports = {
2622
],
2723
},
2824
],
29-
sectionDepth: 2,
3025
},
3126
{
3227
name: 'Components',
33-
content: 'docs/Components.md',
3428
sections: [
3529
{
3630
name: 'Buttons',
37-
components: () => ['./src/components/Button/Button.js'],
38-
exampleMode: 'expand', // 'hide' | 'collapse' | 'expand'
39-
usageMode: 'hide', // 'hide' | 'collapse' | 'expand'
31+
components: () => [
32+
'./src/components/Button/Button.js',
33+
'./src/components/RandomButton/RandomButton.js',
34+
'./src/components/WrappedButton/WrappedButton.js',
35+
],
4036
},
4137
{
4238
name: 'Fields',
43-
components: () => ['./src/components/Placeholder/Placeholder.js'],
44-
exampleMode: 'expand', // 'hide' | 'collapse' | 'expand'
45-
usageMode: 'expand', // 'hide' | 'collapse' | 'expand'
46-
},
47-
{
48-
name: 'Others',
49-
components: () => ['./src/components/RandomButton/RandomButton.js'],
50-
exampleMode: 'collapse', // 'hide' | 'collapse' | 'expand'
51-
usageMode: 'collapse', // 'hide' | 'collapse' | 'expand'
39+
components: () => [
40+
'./src/components/Label/Label.js',
41+
'./src/components/Placeholder/Placeholder.js',
42+
],
5243
},
5344
],
54-
sectionDepth: 0,
5545
},
5646
],
5747
require: [path.join(__dirname, 'src/styles.css')],

loaders/utils/__tests__/__snapshots__/getSections.spec.js.snap

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ Array [
88
"require": "!!~/loaders/examples-loader.js!~/test/components/Button/Readme.md",
99
},
1010
"description": undefined,
11-
"exampleMode": "collapse",
1211
"filepath": "components/Button/Readme.md",
1312
"name": "Readme",
14-
"sectionDepth": 0,
1513
"sections": Array [],
1614
"slug": "readme-1",
17-
"usageMode": "collapse",
1815
},
1916
Object {
2017
"components": Array [
@@ -88,13 +85,10 @@ Array [
8885
],
8986
"content": undefined,
9087
"description": undefined,
91-
"exampleMode": "collapse",
9288
"filepath": undefined,
9389
"name": "Components",
94-
"sectionDepth": 0,
9590
"sections": Array [],
9691
"slug": "components-1",
97-
"usageMode": "collapse",
9892
},
9993
Object {
10094
"components": Array [
@@ -155,13 +149,10 @@ Array [
155149
],
156150
"content": undefined,
157151
"description": undefined,
158-
"exampleMode": "collapse",
159152
"filepath": undefined,
160153
"name": "Ignore",
161-
"sectionDepth": 0,
162154
"sections": Array [],
163155
"slug": "ignore-1",
164-
"usageMode": "collapse",
165156
},
166157
]
167158
`;
@@ -239,13 +230,10 @@ Object {
239230
],
240231
"content": undefined,
241232
"description": undefined,
242-
"exampleMode": "collapse",
243233
"filepath": undefined,
244234
"name": "Components",
245-
"sectionDepth": 0,
246235
"sections": Array [],
247236
"slug": "components",
248-
"usageMode": "collapse",
249237
}
250238
`;
251239

@@ -256,13 +244,10 @@ Object {
256244
"require": "!!~/loaders/examples-loader.js!~/test/components/Button/Readme.md",
257245
},
258246
"description": undefined,
259-
"exampleMode": "collapse",
260247
"filepath": "components/Button/Readme.md",
261248
"name": "Readme",
262-
"sectionDepth": 0,
263249
"sections": Array [],
264250
"slug": "readme",
265-
"usageMode": "collapse",
266251
}
267252
`;
268253

@@ -326,12 +311,9 @@ Object {
326311
],
327312
"content": undefined,
328313
"description": undefined,
329-
"exampleMode": "collapse",
330314
"filepath": undefined,
331315
"name": "Ignore",
332-
"sectionDepth": 0,
333316
"sections": Array [],
334317
"slug": "ignore",
335-
"usageMode": "collapse",
336318
}
337319
`;

0 commit comments

Comments
 (0)