more dark theme stuff

This commit is contained in:
catarak 2016-09-14 12:46:54 -04:00 committed by Cassie Tarakajian
parent 60ebfde298
commit 900f01c2d5
6 changed files with 176 additions and 170 deletions

View file

@ -1,12 +1,10 @@
import React, { PropTypes } from 'react'; import React, { PropTypes } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import DevTools from './components/DevTools'; import DevTools from './components/DevTools';
import classNames from 'classnames';
class App extends React.Component { class App extends React.Component {
constructor(props, context) { constructor(props, context) {
super(props, context); super(props, context);
console.log(props);
this.state = { isMounted: false }; this.state = { isMounted: false };
} }
@ -15,14 +13,8 @@ class App extends React.Component {
} }
render() { render() {
const theme = this.props.route.theme;
const appClass = classNames({
app: true,
light: theme === 'light',
dark: theme === 'dark'
});
return ( return (
<div className={appClass}> <div className="app">
{this.state.isMounted && !window.devToolsExtension && process.env.NODE_ENV === 'development' && <DevTools />} {this.state.isMounted && !window.devToolsExtension && process.env.NODE_ENV === 'development' && <DevTools />}
{this.props.children} {this.props.children}
</div> </div>
@ -31,10 +23,7 @@ class App extends React.Component {
} }
App.propTypes = { App.propTypes = {
children: PropTypes.object, children: PropTypes.object
route: PropTypes.shape({
theme: PropTypes.string.isRequired
}).isRequired
}; };
export default connect()(App); export default connect()(App);

View file

@ -27,6 +27,7 @@ import SplitPane from 'react-split-pane';
import Overlay from '../../App/components/Overlay'; import Overlay from '../../App/components/Overlay';
import SketchList from '../components/SketchList'; import SketchList from '../components/SketchList';
import About from '../components/About'; import About from '../components/About';
import classNames from 'classnames';
class IDEView extends React.Component { class IDEView extends React.Component {
constructor(props) { constructor(props) {
@ -156,8 +157,14 @@ class IDEView extends React.Component {
} }
render() { render() {
let ideClass = classNames({
ide: true,
light: this.props.preferences.theme === 'light',
dark: this.props.preferences.theme === 'dark',
});
return ( return (
<div className="ide"> <div className={ideClass}>
<div className="ide-content">
{this.props.toast.isVisible && <Toast />} {this.props.toast.isVisible && <Toast />}
<Nav <Nav
user={this.props.user} user={this.props.user}
@ -307,6 +314,7 @@ class IDEView extends React.Component {
</SplitPane> </SplitPane>
</SplitPane> </SplitPane>
</div> </div>
</div>
{(() => { {(() => {
if (this.props.ide.modalIsVisible) { if (this.props.ide.modalIsVisible) {
return ( return (

View file

@ -14,7 +14,7 @@ const checkAuth = (store) => {
const routes = (store) => const routes = (store) =>
( (
<Route path="/" component={App} theme={store.getState().preferences.theme}> <Route path="/" component={App}>
<IndexRoute component={IDEView} onEnter={checkAuth(store)} /> <IndexRoute component={IDEView} onEnter={checkAuth(store)} />
<Route path="/login" component={LoginView} /> <Route path="/login" component={LoginView} />
<Route path="/signup" component={SignupView} /> <Route path="/signup" component={SignupView} />

View file

@ -111,10 +111,12 @@
} }
%modal { %modal {
background-color: $light-modal-background-color; @include themify() {
border: 1px solid $light-modal-border-color; background-color: getThemifyVariable('modal-background-color');
border: 1px solid getThemifyVariable('modal-border-color');
box-shadow: 0 12px 12px getThemifyVariable('shadow-color');
}
border-radius: 2px; border-radius: 2px;
box-shadow: 0 12px 12px $light-shadow-color;
z-index: 20; z-index: 20;
} }

View file

@ -13,22 +13,20 @@ body, input, button {
font-family: 'Avenir Next', Montserrat, sans-serif; font-family: 'Avenir Next', Montserrat, sans-serif;
} }
body {
background-color: $light-background-color;
}
.root-app, .app { .root-app, .app {
min-height: 100%; min-height: 100%;
height: 100%; height: 100%;
} }
a { a {
@include themify() {
text-decoration: none; text-decoration: none;
color: $light-inactive-text-color; color: getThemifyVariable('inactive-text-color');
cursor: pointer; cursor: pointer;
&:hover { &:hover {
text-decoration: none; text-decoration: none;
color: $light-primary-text-color; color: getThemifyVariable('primary-text-color');
}
} }
} }

View file

@ -1,8 +1,17 @@
.ide { .ide {
height: 100%;
width: 100%;
}
.ide-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
flex-wrap: wrap; flex-wrap: wrap;
@include themify() {
color: getThemifyVariable('primary-text-color');
background-color: getThemifyVariable('background-color');
}
} }
.editor-preview-container { .editor-preview-container {