Skip to content

Commit 56e2090

Browse files
MrKou47sapegin
authored andcommitted
Docs: Fix extra heading in customized example (styleguidist#1107)
Closes styleguidist#1102
1 parent cf7f1ef commit 56e2090

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

examples/customised/styleguide.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = {
4747
styleguideComponents: {
4848
LogoRenderer: path.join(__dirname, 'styleguide/components/Logo'),
4949
StyleGuideRenderer: path.join(__dirname, 'styleguide/components/StyleGuide'),
50-
SectionsRenderer: path.join(__dirname, 'styleguide/components/Sections'),
50+
SectionsRenderer: path.join(__dirname, 'styleguide/components/SectionsRenderer'),
5151
},
5252
webpackConfig: {
5353
module: {

examples/customised/styleguide/components/Sections.js renamed to examples/customised/styleguide/components/SectionsRenderer.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
33
import Styled from 'rsg-components/Styled';
44
import Heading from 'rsg-components/Heading';
55
// Import default implementation from react-styleguidist using the full path
6-
import DefaultSections from 'react-styleguidist/lib/rsg-components/Sections/SectionsRenderer';
6+
import DefaultSectionsRenderer from 'react-styleguidist/lib/rsg-components/Sections/SectionsRenderer';
77

88
const styles = ({ fontFamily, color, space }) => ({
99
headingSpacer: {
@@ -18,11 +18,12 @@ const styles = ({ fontFamily, color, space }) => ({
1818
export function SectionsRenderer({ classes, children }) {
1919
return (
2020
<div>
21-
<div className={classes.headingSpacer}>
22-
<Heading level={1}>Example Components</Heading>
23-
<p className={classes.descriptionText}>These are the greatest components</p>
24-
</div>
25-
<DefaultSections>{children}</DefaultSections>
21+
{!!children.length &&
22+
<div className={classes.headingSpacer}>
23+
<Heading level={1}>Example Components</Heading>
24+
<p className={classes.descriptionText}>These are the greatest components</p>
25+
</div>}
26+
<DefaultSectionsRenderer>{children}</DefaultSectionsRenderer>
2627
</div>
2728
);
2829
}

0 commit comments

Comments
 (0)