add more codeimage stuffs

main
briandennis 8 years ago
parent 171546b179
commit 94e1ce5949

@ -6,9 +6,7 @@ import WindowControls from '../components/svg/controls'
// hack to only call modes on browser // hack to only call modes on browser
if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') { if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') {
require('codemirror/mode/javascript/javascript'); require('../lib/constants')
require('codemirror/mode/xml/xml');
require('codemirror/mode/markdown/markdown');
} }
const margin = '45px 54px' const margin = '45px 54px'
@ -19,7 +17,8 @@ class CodeImage extends React.Component {
super(props) super(props)
this.state = { this.state = {
code: this.props.children code: this.props.children,
config: this.props.config || {}
} }
} }
@ -28,15 +27,14 @@ class CodeImage extends React.Component {
} }
render () { render () {
const options = { lineNumbers: false, mode: 'javascript' } const options = { lineNumbers: false, mode: 'javascript', theme: 'dracula'}
return ( return (
<div id='section'> <div id='section'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.26.0/codemirror.min.css'/> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.26.0/codemirror.min.css'/>
<div id='container' style={Object.assign({ background: this.props.bg }, this.props.style)}> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.26.0/theme/dracula.min.css'/>
<div className="window-controls"> <div id='container' style={Object.assign({ background: this.state.config.bg }, this.props.style)}>
<WindowControls /> { true ? <WindowControls /> : null }
</div>
<div id='anotherContainer'> <div id='anotherContainer'>
<CodeMirror value={this.state.code} onChange={this.updateCode} options={options} /> <CodeMirror value={this.state.code} onChange={this.updateCode} options={options} />
</div> </div>
@ -61,12 +59,6 @@ class CodeImage extends React.Component {
align-items: center; align-items: center;
} }
.window-controls {
position: absolute;
margin-left: -2px;
margin-top: -14px;
}
.hyper { .hyper {
border: 1px solid #393939; border: 1px solid #393939;
border-radius: 5px; border-radius: 5px;

Loading…
Cancel
Save