more half finished theme stuff

This commit is contained in:
catarak 2016-09-14 11:55:53 -04:00 committed by Cassie Tarakajian
parent c9b2d178b2
commit 60ebfde298
10 changed files with 50 additions and 50 deletions

View File

@ -1,10 +1,12 @@
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 };
} }
@ -13,8 +15,14 @@ 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="app"> <div className={appClass}>
{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>
@ -23,7 +31,10 @@ 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,7 +27,6 @@ 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) {
@ -157,13 +156,8 @@ 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={ideClass}> <div className="ide">
{this.props.toast.isVisible && <Toast />} {this.props.toast.isVisible && <Toast />}
<Nav <Nav
user={this.props.user} user={this.props.user}

View File

@ -14,7 +14,7 @@ const checkAuth = (store) => {
const routes = (store) => const routes = (store) =>
( (
<Route path="/" component={App}> <Route path="/" component={App} theme={store.getState().preferences.theme}>
<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

@ -3,13 +3,12 @@
.#{$theme} & { .#{$theme} & {
// Define theme color // Define theme color
$theme-map : ( $theme-map : (
color-alpha: blue
) !global; ) !global;
@each $key, $submap in $map { @each $key, $submap in $map {
$value: map-fetch($themes, $theme '#{$key}'); $value: map-fetch($themes, $theme '#{$key}');
$theme-map: map-merge($theme-map, ($key: $value)) !global; $theme-map: map-merge($theme-map, ($key: $value)) !global;
} }
@content; @content;

View File

@ -93,25 +93,21 @@
} }
} }
%fake-link {
color: $light-inactive-text-color;
cursor: pointer;
&:hover {
color: $light-primary-text-color;
}
}
%preference-option { %preference-option {
background-color: $light-button-background-color; @include themify() {
color: $light-inactive-text-color; background-color: transparent;
color: getThemifyVariable('inactive-text-color');
&:hover {
color: getThemifyVariable('primary-text-color');
}
}
font-size: #{12 / $base-font-size}rem; font-size: #{12 / $base-font-size}rem;
cursor: pointer; cursor: pointer;
text-align: left; text-align: left;
margin-bottom: #{5 / $base-font-size}rem; margin-bottom: #{5 / $base-font-size}rem;
border: 0px; border: 0;
&:hover { padding: 0;
color: $light-primary-text-color; list-style-type: none;
}
} }
%modal { %modal {

View File

@ -7,8 +7,10 @@ html, body {
} }
body, input, button { body, input, button {
@include themify() {
color: getThemifyVariable('primary-text-color');
}
font-family: 'Avenir Next', Montserrat, sans-serif; font-family: 'Avenir Next', Montserrat, sans-serif;
color: $light-primary-text-color;
} }
body { body {

View File

@ -1,10 +1,6 @@
.github-button { .github-button {
@include themify() { @include themify() {
@extend %button; @extend %button;
width: #{300 / $base-font-size}rem;
display: flex;
justify-content: center;
align-items: center;
& path { & path {
color: getThemifyVariable('primary-text-color'); color: getThemifyVariable('primary-text-color');
} }
@ -16,6 +12,10 @@
border-color: getThemifyVariable('secondary-text-color'); border-color: getThemifyVariable('secondary-text-color');
} }
} }
width: #{300 / $base-font-size}rem;
display: flex;
justify-content: center;
align-items: center;
} }
.github-icon { .github-icon {

View File

@ -16,10 +16,6 @@
border-bottom: 2px dashed; border-bottom: 2px dashed;
} }
.nav__save, .nav__new {
@extend %fake-link;
}
.nav__item { .nav__item {
& + & { & + & {
margin-left: #{20 / $base-font-size}rem; margin-left: #{20 / $base-font-size}rem;

View File

@ -88,17 +88,16 @@
} }
.preference__option { .preference__option {
@extend %preference-option; @include themify() {
list-style-type: none; @extend %preference-option;
padding: 0; }
color: $light-inactive-text-color;
} }
.preference__preview-button { .preference__preview-button {
@extend %preference-option; @include themify() {
padding: 0; @extend %preference-option;
padding-left: #{110 / $base-font-size}rem; padding-left: #{110 / $base-font-size}rem;
outline: none; }
} }
.preference__options { .preference__options {
@ -108,7 +107,10 @@
} }
.preference__radio-button:checked + .preference__option { .preference__radio-button:checked + .preference__option {
color: $light-primary-text-color; @include themify() {
//for some reason this won't work for getThemifyVariable
color: map-get($theme-map, 'primary-text-color');
}
} }
.preference--hidden { .preference--hidden {

View File

@ -1,13 +1,13 @@
.toolbar__play-button { .toolbar__play-button {
@include themify() { @include themify() {
@extend %toolbar-button; @extend %toolbar-button;
margin-right: #{15 / $base-font-size}rem;
&--selected { &--selected {
@extend %toolbar-button--selected; @extend %toolbar-button--selected;
} }
& span { }
padding-left: #{2 / $base-font-size}rem; margin-right: #{15 / $base-font-size}rem;
} & span {
padding-left: #{2 / $base-font-size}rem;
} }
} }
@ -27,12 +27,12 @@
.toolbar__preferences-button { .toolbar__preferences-button {
@include themify() { @include themify() {
@extend %toolbar-button; @extend %toolbar-button;
line-height: #{50 / $base-font-size}rem;
margin-left: auto;
&--selected { &--selected {
@extend %toolbar-button--selected; @extend %toolbar-button--selected;
} }
} }
line-height: #{50 / $base-font-size}rem;
margin-left: auto;
} }
.toolbar__logo { .toolbar__logo {