Skip to content

Commit

Permalink
feat: Only render editor if the component is live otherwise render co…
Browse files Browse the repository at this point in the history
…de snippet
  • Loading branch information
jerelmiller committed Jun 3, 2020
1 parent 9a43c6c commit 7ad682d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/ComponentExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ const ComponentExample = ({
}) => {
const [stylesLoaded, setStylesLoaded] = useState(false);
const ToastManager = window.__NR1_SDK__.ToastManager;
const { live } = example.options;
let formattedCode;

try {
Expand All @@ -120,9 +121,9 @@ const ComponentExample = ({
}}
code={formattedCode}
theme={github}
disabled={!example.options.live}
disabled={!live}
>
{example.options.live && (
{live && (
<root.div className={styles.preview}>
<link
rel="stylesheet"
Expand All @@ -146,7 +147,7 @@ const ComponentExample = ({
</root.div>
)}
<LiveEditor style={{ fontSize: '0.75rem' }} />
<LiveError className={styles.error} />
{live && <LiveError className={styles.error} />}
</LiveProvider>
</div>
);
Expand Down

0 comments on commit 7ad682d

Please sign in to comment.