Skip to content

Commit

Permalink
Merge pull request #181 from vohndernet/add-sketch-thumbnail
Browse files Browse the repository at this point in the history
Added sketch thumbnail
  • Loading branch information
mattxwang authored Jan 24, 2020
2 parents 83c4823 + 03bf31e commit c27ccf1
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 41 deletions.
84 changes: 44 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/components/TextEditor/components/TextEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ViewportAwareButton from "../../common/ViewportAwareButton.js";
import DropdownButtonContainer from "../../common/containers/DropdownButtonContainer";
import { faSave } from "@fortawesome/free-solid-svg-icons";
import { faDownload } from "@fortawesome/free-solid-svg-icons";

import { SketchThumbnailArray } from "../../Sketches/constants";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

let CodeMirror = null;
Expand Down Expand Up @@ -114,9 +114,15 @@ class TextEditor extends React.Component {
renderDropdown = () => <DropdownButtonContainer />;

renderBanner = () => {
let thumbnail = SketchThumbnailArray[this.props.thumbnail];
return (
<div className="code-section-banner">
<OpenPanelButtonContainer />
<img
className="program-sketch-thumbnail"
src={`${process.env.PUBLIC_URL}/img/sketch-thumbnails/${thumbnail}.svg`}
alt="sketch thumbnail"
/>
{this.renderDropdown()}
<div style={{ marginLeft: "auto", marginRight: ".5rem" }}>
<EditorRadio
Expand Down
15 changes: 15 additions & 0 deletions src/styles/Editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@
}
}

.program-sketch-thumbnail {
position: relative;
left: 6px;
height: 50px;
width: 50px;
padding: 4px;
border-radius: 25px;
@include themify($themes) {
background-color: themed("cardBackground")
}
}


.code-section-banner {
display: flex;
flex-direction: row;
Expand All @@ -49,6 +62,8 @@
}

.editor-language-dropdown {
position: relative;
left: 6px;
flex: 0 1 auto;
}

Expand Down

0 comments on commit c27ccf1

Please sign in to comment.