diff --git a/components/Carbon.js b/components/Carbon.js index 1aec6de..74f0fb0 100644 --- a/components/Carbon.js +++ b/components/Carbon.js @@ -16,7 +16,7 @@ const DEFAULT_SETTINGS = { marginVertical: '45px', marginHorizontal: '45px', background: '#fed0ec', - theme: 'dracula', + theme: 'seti', language: DEFAULT_LANGUAGE } @@ -116,7 +116,7 @@ class Carbon extends React.Component { } #container :global(.CodeMirror__container.dropshadow) { - box-shadow: 0px 3px 15px rgba(0,0,0,0.3); + box-shadow: 0 20px 68px rgba(0, 0, 0, 0.55); border-radius: 5px; } diff --git a/components/Meta.js b/components/Meta.js index c4335d5..74cb8e9 100644 --- a/components/Meta.js +++ b/components/Meta.js @@ -1,5 +1,5 @@ import Head from 'next/head' -import { THEMES, COLORS } from '../lib/constants' +import { THEMES_ARRAY, COLORS } from '../lib/constants' import Reset from './style/Reset' import Typography from './style/Typography' @@ -20,8 +20,13 @@ export default () => ( { +<<<<<<< HEAD THEMES.map((theme, i) => ( +======= + THEMES_ARRAY.map((theme, i) => ( + +>>>>>>> Default theme )) } diff --git a/lib/constants.js b/lib/constants.js index dd7f741..d8bc0da 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -1,4 +1,6 @@ -export const THEMES = [ +import { toHash } from './util' + +export const THEMES_ARRAY = [ { id: '3024-night', name: '3024 Night' @@ -63,6 +65,8 @@ export const THEMES = [ } ] +export const THEMES = toHash(THEMES_ARRAY) + export const LANGUAGES = [ { name: 'Auto' @@ -258,7 +262,7 @@ export const COLORS = { BLACK: '#121212', PRIMARY: '#F8E81C', SECONDARY: '#fff', - GRAY: '#b5b3a0' + GRAY: '#858585' } export const DEFAULT_CODE = `const pluckDeep = key => obj => key.split('.').reduce((accum, key) => accum[key], obj) diff --git a/lib/util.js b/lib/util.js new file mode 100644 index 0000000..c7a883a --- /dev/null +++ b/lib/util.js @@ -0,0 +1,10 @@ +export const toHash = (array) => { + return array.reduce((hash, item) => { + const id = item.id + if (hash[id]) { + throw new Error('ID already exists') + } + hash[id] = item + return hash + }, {}) +} diff --git a/pages/editor.js b/pages/editor.js index 3e05380..698e506 100644 --- a/pages/editor.js +++ b/pages/editor.js @@ -16,6 +16,7 @@ import Overlay from '../components/Overlay' import Carbon from '../components/Carbon' import api from '../lib/api' import { + THEMES_ARRAY, THEMES, LANGUAGES, DEFAULT_LANGUAGE, @@ -42,7 +43,7 @@ class Editor extends React.Component { super(props) this.state = { background: '#ABB8C3', - theme: THEMES[0].id, + theme: THEMES.seti.id, language: DEFAULT_LANGUAGE, dropShadow: true, windowControls: true, @@ -102,7 +103,7 @@ class Editor extends React.Component { - this.setState({ theme: theme.id })}/> + this.setState({ theme: theme.id })}/> this.setState({ language: language.module })}/> this.setState({ background: color })}