Skip to content

Commit

Permalink
prevent html code example from crashing when children is array
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajk committed Mar 3, 2020
1 parent 0c9bb29 commit 2050bf8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/styleguide/src/components/Preview/CodeExample.js
Expand Up @@ -167,18 +167,15 @@ export default class CodeExample extends React.Component {
}

render() {
const { children, codeJSXOptions, codeTypes, theme, ...other } = this.props;
const { children, codeJSXOptions, codeTypes, ...other } = this.props;

let codeToShow;
switch (this.state.codePreviewType) {
case 'html':
codeToShow = pretty(
typeof children === 'string'
? unescape(children)
: renderToStaticMarkup({
...children,
props: { ...children.props, theme },
}),
: renderToStaticMarkup(children),
{
ocd: true,
}
Expand Down

0 comments on commit 2050bf8

Please sign in to comment.