Skip to content

Commit

Permalink
fix: Only show examples if there are examples to show
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 3, 2020
1 parent 845cb07 commit 7e6733d
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/templates/ReferenceTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,20 @@ const ReferenceTemplate = ({ data }) => {
<section className={cx(styles.section, styles.description)}>
<ReactMarkdown source={componentData.__docs__.text} />
</section>
<section className={styles.section}>
<h2>Examples</h2>
<div>
{examples.map((example, i) => (
<ComponentExample
key={i}
className={styles.componentExample}
example={example}
/>
))}
</div>
</section>
{examples.length > 0 && (
<section className={styles.section}>
<h2>Examples</h2>
<div>
{examples.map((example, i) => (
<ComponentExample
key={i}
className={styles.componentExample}
example={example}
/>
))}
</div>
</section>
)}
</>
)}
</main>
Expand Down

0 comments on commit 7e6733d

Please sign in to comment.