fix(ui): output theme in night mode
This commit is contained in:
@ -1,10 +1,12 @@
|
|||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
import NoSSR from 'react-no-ssr';
|
import NoSSR from 'react-no-ssr';
|
||||||
import Codemirror from 'react-codemirror';
|
import Codemirror from 'react-codemirror';
|
||||||
|
|
||||||
import ns from './ns.json';
|
import ns from './ns.json';
|
||||||
import CodeMirrorSkeleton from './Code-Mirror-Skeleton.jsx';
|
import CodeMirrorSkeleton from './Code-Mirror-Skeleton.jsx';
|
||||||
|
import { themeSelector } from '../../redux';
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
lineNumbers: false,
|
lineNumbers: false,
|
||||||
@ -13,19 +15,23 @@ const defaultOptions = {
|
|||||||
readOnly: 'nocursor'
|
readOnly: 'nocursor'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const mapStateToProps = state => ({ theme: themeSelector(state) });
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
defaultOutput: PropTypes.string,
|
defaultOutput: PropTypes.string,
|
||||||
output: PropTypes.string
|
output: PropTypes.string,
|
||||||
|
theme: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class Output extends PureComponent {
|
export class Output extends PureComponent {
|
||||||
render() {
|
render() {
|
||||||
const { output, defaultOutput } = this.props;
|
const { output, defaultOutput } = this.props;
|
||||||
|
const cmTheme = this.props.theme === 'default' ? 'default' : 'dracula';
|
||||||
return (
|
return (
|
||||||
<div className={ `${ns}-log` }>
|
<div className={ `${ns}-log` }>
|
||||||
<NoSSR onSSR={ <CodeMirrorSkeleton content={ output } /> }>
|
<NoSSR onSSR={ <CodeMirrorSkeleton content={ output } /> }>
|
||||||
<Codemirror
|
<Codemirror
|
||||||
options={ defaultOptions }
|
options={{ ...defaultOptions, theme: cmTheme }}
|
||||||
value={ output || defaultOutput }
|
value={ output || defaultOutput }
|
||||||
/>
|
/>
|
||||||
</NoSSR>
|
</NoSSR>
|
||||||
@ -36,3 +42,5 @@ export default class Output extends PureComponent {
|
|||||||
|
|
||||||
Output.displayName = 'Output';
|
Output.displayName = 'Output';
|
||||||
Output.propTypes = propTypes;
|
Output.propTypes = propTypes;
|
||||||
|
|
||||||
|
export default connect(mapStateToProps)(Output);
|
||||||
|
@ -87,6 +87,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.@{ns}-log {
|
||||||
|
border: 1px solid @brand-primary;
|
||||||
|
}
|
||||||
|
|
||||||
.night {
|
.night {
|
||||||
.@{ns}-instructions blockquote {
|
.@{ns}-instructions blockquote {
|
||||||
background-color: #242424;
|
background-color: #242424;
|
||||||
@ -117,9 +121,8 @@
|
|||||||
caret-color:#ABABAB;
|
caret-color:#ABABAB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.@{ns}-log .CodeMirror {
|
.@{ns}-log {
|
||||||
background-color: #282a36;
|
border: none;
|
||||||
color: #f8f8f2;
|
|
||||||
}
|
}
|
||||||
.refresh-icon {
|
.refresh-icon {
|
||||||
color: @icon-light-gray;
|
color: @icon-light-gray;
|
||||||
|
Reference in New Issue
Block a user