mirror of
https://github.com/BorysLevytskyi/BitwiseCmd.git
synced 2025-12-10 06:52:05 +01:00
Support dark and light theme
This commit is contained in:
@@ -3,6 +3,7 @@ class AppState {
|
||||
this.emphasizeBytes = true;
|
||||
this.commandResults = [];
|
||||
this.handlers = [];
|
||||
this.uiTheme = 'dark'
|
||||
}
|
||||
|
||||
addCommandResult(result) {
|
||||
@@ -29,6 +30,11 @@ class AppState {
|
||||
h();
|
||||
}
|
||||
}
|
||||
|
||||
setUiTheme(theme) {
|
||||
this.uiTheme = theme;
|
||||
this.triggerChanged();
|
||||
}
|
||||
};
|
||||
|
||||
var appState = new AppState();
|
||||
|
||||
@@ -34,10 +34,10 @@ export default {
|
||||
cmdConfig.emphasizeBytes = !cmdConfig.emphasizeBytes;
|
||||
},
|
||||
'dark': function() {
|
||||
cmdConfig.theme = 'dark';
|
||||
appState.setUiTheme('dark');
|
||||
},
|
||||
'light': function () {
|
||||
cmdConfig.theme = 'light';
|
||||
appState.setUiTheme('light');
|
||||
},
|
||||
'about': function() {
|
||||
var aboutResult = document.querySelector('.result .aboutTpl');
|
||||
|
||||
@@ -12,33 +12,33 @@ export default class AppRoot extends React.Component {
|
||||
}
|
||||
render() {
|
||||
var results = this.state.commandResults.map((r, i) => <DisplayResultView key={i} content={r} input={r.input} inputHash={r.inputHash} />);
|
||||
return <div>
|
||||
<div className="header">
|
||||
<h1>Bitwise<span style={{color: "#c5c5c5"}}>Cmd</span></h1>
|
||||
<ul className="top-links">
|
||||
<li>
|
||||
<a href="https://github.com/BorisLevitskiy/BitwiseCmd"><i className="icon github"> </i><span className="link-text">Project on GitHub</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://twitter.com/BitwiseCmd"><i className="icon twitter"> </i><span className="link-text">Twitter</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="mailto:bitwisecmd@gmail.com?subject=Feedback"><i className="icon feedback"> </i><span className="link-text">Send Feedback</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
return <div className={`app-root ${this.state.uiTheme}`}>
|
||||
<div className="header">
|
||||
<h1>Bitwise<span style={{color: "#c5c5c5"}}>Cmd</span></h1>
|
||||
<ul className="top-links">
|
||||
<li>
|
||||
<a href="https://github.com/BorisLevitskiy/BitwiseCmd"><i className="icon github"> </i><span className="link-text">Project on GitHub</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://twitter.com/BitwiseCmd"><i className="icon twitter"> </i><span className="link-text">Twitter</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="mailto:bitwisecmd@gmail.com?subject=Feedback"><i className="icon feedback"> </i><span className="link-text">Send Feedback</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div className="expressionInput-container">
|
||||
<InputBox />
|
||||
<div className="expressionInput-container">
|
||||
<InputBox />
|
||||
|
||||
<span className="configPnl">
|
||||
<span id="emphasizeBytes" data-cmd="em" className="indicator on" title="Emphasize Bytes">[em]</span>
|
||||
</span>
|
||||
</div>
|
||||
<span className="configPnl">
|
||||
<span id="emphasizeBytes" data-cmd="em" className="indicator on" title="Emphasize Bytes">[em]</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="output">
|
||||
{results}
|
||||
</div>
|
||||
</div>;
|
||||
<div id="output">
|
||||
{results}
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
body { padding:0; margin:0; height: 100%; overflow: hidden; }
|
||||
html { height: 100% }
|
||||
#root { font-family: Verdana; font-size: 0.8em; margin: 0; padding: 20px 100px 0 100px; height: 100%; overflow: auto; }
|
||||
|
||||
.app-root { font-family: Verdana; font-size: 0.8em; margin: 0; padding: 20px 100px 0 100px; height: 100%; overflow: auto; }
|
||||
code { font-size: 1.2em; font-weight: bold; }
|
||||
|
||||
.top-links { position: absolute; right: 10px; top: 10px; list-style-type: none; margin: 0 }
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="css/styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" class="dark">Doesn't work</div>
|
||||
<div id="root">Ooops... Something went wrong ¯\_(ツ)_/¯</div>
|
||||
<script src="/bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user