Skip to content

Commit

Permalink
fix #8128: addon-centered clashing with addon-docs for react (#8388)
Browse files Browse the repository at this point in the history
fix #8128: addon-centered clashing with addon-docs for react
  • Loading branch information
ndelangen committed Feb 3, 2020
2 parents a76346b + 0357a94 commit c78b4f9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions addons/centered/src/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ import parameters from './parameters';
import styles from './styles';

function centered(storyFn: () => ReactNode) {
/* eslint-disable no-undef */
if (window) {
const params = new URL(window.location.href).search;
const isInDocsView = params.includes('viewMode=docs');

if (isInDocsView) {
return storyFn();
}
}
/* eslint-enable no-undef */

return (
<div style={styles.style}>
<div style={styles.innerStyle}>{storyFn()}</div>
Expand Down

0 comments on commit c78b4f9

Please sign in to comment.