Skip to content

Commit

Permalink
feat: Disable editing if there is no preview to show
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 3, 2020
1 parent 50ef393 commit c7a4a60
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/ComponentExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ const ComponentExample = ({ className, example }) => {
}}
code={formattedCode}
theme={github}
disabled={!example.options.live}
>
<LivePreview className={styles.preview} />
{example.options.live && <LivePreview className={styles.preview} />}
<LiveEditor style={{ fontSize: '0.75rem' }} />
<LiveError className={styles.error} />
</LiveProvider>
Expand All @@ -44,6 +45,7 @@ ComponentExample.propTypes = {
example: PropTypes.shape({
label: PropTypes.string.isRequired,
sourceCode: PropTypes.string.isRequired,
options: PropTypes.object.isRequired,
}).isRequired,
};

Expand Down

0 comments on commit c7a4a60

Please sign in to comment.