Skip to content

Commit

Permalink
feat: add preview styles for code block
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jul 8, 2020
1 parent ad7f59c commit 2f2a9b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/CodeBlock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import Button from './Button';
import CodeEditor from './CodeEditor';
import CodeHighlight from './CodeHighlight';
Expand Down Expand Up @@ -37,8 +38,8 @@ const CodeBlock = ({

return (
<LiveProvider code={code} scope={scope}>
{preview && <components.Preview />}
<div className={styles.container}>
{preview && <components.Preview className={styles.preview} />}
<div className={cx(styles.container, { [styles.withPreview]: preview })}>
{live ? (
<CodeEditor
value={code}
Expand Down
14 changes: 14 additions & 0 deletions src/components/CodeBlock.module.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
.container {
background: var(--color-nord-0);
border-radius: 4px;

&.withPreview {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
}

.statusBar {
Expand Down Expand Up @@ -44,3 +49,12 @@
margin-top: 0.5rem;
border-radius: 2px;
}

.preview {
padding: 2rem;
background: var(--color-white);
border: 1px solid var(--color-neutrals-100);
box-shadow: var(--boxshadow);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}

0 comments on commit 2f2a9b8

Please sign in to comment.