Start global color palette

main
Jake Dexheimer 7 years ago
parent 95ae960536
commit 2729531ad6

@ -1,6 +1,7 @@
import React from 'react' import React from 'react'
import enhanceWithClickOutside from 'react-click-outside' import enhanceWithClickOutside from 'react-click-outside'
import ArrowDown from './svg/Arrowdown' import ArrowDown from './svg/Arrowdown'
import { PALETTE } from '../lib/constants'
class Dropdown extends React.Component { class Dropdown extends React.Component {
constructor(props) { constructor(props) {
@ -34,7 +35,7 @@ class Dropdown extends React.Component {
<span>{ item.name }</span> <span>{ item.name }</span>
<style jsx>{` <style jsx>{`
.dropdown-list-item { .dropdown-list-item {
background: #131313; background: ${PALETTE.EDITOR_BG};
user-select: none; user-select: none;
padding: 8px 16px; padding: 8px 16px;
border-bottom: 0.5px solid #000; border-bottom: 0.5px solid #000;

@ -235,6 +235,10 @@ export const LANGUAGES = [
} }
] ]
export const PALETTE = {
'EDITOR_BG': '#1A1A1A'
}
export const DEFAULT_CODE = `const pluckDeep = key => obj => key.split('.').reduce((accum, key) => accum[key], obj) export const DEFAULT_CODE = `const pluckDeep = key => obj => key.split('.').reduce((accum, key) => accum[key], obj)
const compose = (...fns) => res => fns.reduce((accum, next) => next(accum), res) const compose = (...fns) => res => fns.reduce((accum, next) => next(accum), res)

@ -9,7 +9,7 @@ import Meta from '../components/Meta'
import Toolbar from '../components/Toolbar' import Toolbar from '../components/Toolbar'
import CodeImage from '../components/CodeImage' import CodeImage from '../components/CodeImage'
import api from '../lib/api' import api from '../lib/api'
import { THEMES, LANGUAGES, DEFAULT_CODE } from '../lib/constants' import { THEMES, LANGUAGES, PALETTE, DEFAULT_CODE } from '../lib/constants'
class Index extends React.Component { class Index extends React.Component {
/* pathname, asPath, err, req, res */ /* pathname, asPath, err, req, res */
@ -69,7 +69,8 @@ class Index extends React.Component {
onBGChange={color => this.setState({ background: color })} onBGChange={color => this.setState({ background: color })}
onThemeChange={theme => this.setState({ theme: theme.id })} onThemeChange={theme => this.setState({ theme: theme.id })}
onLanguageChange={language => this.setState({ language })} onLanguageChange={language => this.setState({ language })}
bg={this.state.bgColor} onSettingsChange={settings => this.setState({ settings })}
bg={this.state.background}
/> />
<CodeImage config={this.state}> <CodeImage config={this.state}>
{this.droppedContent || this.props.content || DEFAULT_CODE} {this.droppedContent || this.props.content || DEFAULT_CODE}
@ -106,7 +107,7 @@ class Index extends React.Component {
} }
#editor { #editor {
background: #151515; background: ${PALETTE.EDITOR_BG};
padding: 16px; padding: 16px;
} }

Loading…
Cancel
Save