From 1bba205853f0f58196b8f23f565ebeeabe8a514b Mon Sep 17 00:00:00 2001 From: Jake Dexheimer Date: Sun, 16 Jul 2017 16:20:37 -0700 Subject: [PATCH] Wire-up window theme functionality --- components/CodeImage.js | 5 +-- components/Meta.js | 8 ++++ components/Settings.js | 2 +- components/ThemeSelect.js | 44 +++++++++++-------- components/svg/{Themes.js => WindowThemes.js} | 12 ++--- pages/index.js | 3 +- 6 files changed, 45 insertions(+), 29 deletions(-) rename components/svg/{Themes.js => WindowThemes.js} (77%) diff --git a/components/CodeImage.js b/components/CodeImage.js index db1fd71..6c0fa61 100644 --- a/components/CodeImage.js +++ b/components/CodeImage.js @@ -15,8 +15,7 @@ const DEFAULT_SETTINGS = { language: 'javascript' } - class CodeImage extends React.Component { - +class CodeImage extends React.Component { constructor (props) { super(props) @@ -66,7 +65,7 @@ const DEFAULT_SETTINGS = {
{ config.windowControls ? : null } diff --git a/components/Meta.js b/components/Meta.js index 3345280..90e2406 100644 --- a/components/Meta.js +++ b/components/Meta.js @@ -71,6 +71,14 @@ export default () => ( font-size: 0.7rem; } + .window-theme__sharp > .CodeMirror { + border-radius: 0px; + } + + .window-theme__bw > .CodeMirror { + border: 2px solid #fff; + } + .window-controls + .CodeMirror__container > .CodeMirror { padding-top: 40px; } diff --git a/components/Settings.js b/components/Settings.js index a038883..27dac7e 100644 --- a/components/Settings.js +++ b/components/Settings.js @@ -30,7 +30,7 @@ class Settings extends React.Component {
- + ( -
- - -
- )) + .theme:last-of-type { + margin-right: 0px; + } + `} +
+ ) + }) } render() { return (
- Theme + Window Theme
{ this.renderThemes() }
diff --git a/components/svg/Themes.js b/components/svg/WindowThemes.js similarity index 77% rename from components/svg/Themes.js rename to components/svg/WindowThemes.js index 97f0267..208d38e 100644 --- a/components/svg/Themes.js +++ b/components/svg/WindowThemes.js @@ -1,6 +1,6 @@ import React from 'react' -export const Hyper = () => ( +export const Sharp = () => ( @@ -10,11 +10,11 @@ export const Hyper = () => ( - - - - - + + + + + diff --git a/pages/index.js b/pages/index.js index 4851193..09bd1c2 100644 --- a/pages/index.js +++ b/pages/index.js @@ -7,6 +7,7 @@ import domtoimage from 'dom-to-image' import ReadFileDropContainer from '../components/ReadFileDropContainer' import Meta from '../components/Meta' import Toolbar from '../components/Toolbar' +import { WINDOW_THEMES } from '../components/ThemeSelect' import CodeImage from '../components/CodeImage' import Header from '../components/Header' import Footer from '../components/Footer' @@ -33,6 +34,7 @@ class Index extends React.Component { background: '#111111', theme: THEMES[0].id, language: 'javascript', // TODO LANGUAGES[0] + windowTheme: WINDOW_THEMES[0], dropShadow: false, windowControls: true, paddingVertical: '48px', @@ -41,7 +43,6 @@ class Index extends React.Component { } save () { - // domtoimage.toPng(document.getElementById('container')) domtoimage.toPng(document.getElementById('container')) .then((dataUrl) => { const link = document.createElement('a')