summaryrefslogtreecommitdiffstats
path: root/web/react/components/user_settings/premade_theme_chooser.jsx
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-09-23 10:12:40 -0400
committerJoramWilander <jwawilander@gmail.com>2015-09-23 10:12:40 -0400
commite4a15076f458be1416de25b2c45578975b914de5 (patch)
tree0c8a91d17ee2546ee9de969ede2e979c5a4f5a52 /web/react/components/user_settings/premade_theme_chooser.jsx
parent0391e5fe96d922f1e4a6ca2418a871ba1e88c9d2 (diff)
downloadchat-e4a15076f458be1416de25b2c45578975b914de5.tar.gz
chat-e4a15076f458be1416de25b2c45578975b914de5.tar.bz2
chat-e4a15076f458be1416de25b2c45578975b914de5.zip
Implement UI theme colors.
Diffstat (limited to 'web/react/components/user_settings/premade_theme_chooser.jsx')
-rw-r--r--web/react/components/user_settings/premade_theme_chooser.jsx55
1 files changed, 55 insertions, 0 deletions
diff --git a/web/react/components/user_settings/premade_theme_chooser.jsx b/web/react/components/user_settings/premade_theme_chooser.jsx
new file mode 100644
index 000000000..e36503053
--- /dev/null
+++ b/web/react/components/user_settings/premade_theme_chooser.jsx
@@ -0,0 +1,55 @@
+// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+var Utils = require('../../utils/utils.jsx');
+var Constants = require('../../utils/constants.jsx');
+
+export default class PremadeThemeChooser extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {};
+ }
+ render() {
+ const theme = this.props.theme;
+
+ const premadeThemes = [];
+ for (const k in Constants.THEMES) {
+ if (Constants.THEMES.hasOwnProperty(k)) {
+ const premadeTheme = $.extend(true, {}, Constants.THEMES[k]);
+
+ let activeClass = '';
+ if (premadeTheme.type === theme.type) {
+ activeClass = 'active';
+ }
+
+ premadeThemes.push(
+ <div className='col-sm-3 premade-themes'>
+ <div
+ className={activeClass}
+ onClick={() => this.props.updateTheme(premadeTheme)}
+ >
+ <label>
+ <img
+ className='img-responsive'
+ src={'/static/images/themes/' + premadeTheme.type + '.png'}
+ />
+ <div className='theme-label'>{Utils.toTitleCase(premadeTheme.type)}</div>
+ </label>
+ </div>
+ </div>
+ );
+ }
+ }
+
+ return (
+ <div className='row'>
+ {premadeThemes}
+ </div>
+ );
+ }
+}
+
+PremadeThemeChooser.propTypes = {
+ theme: React.PropTypes.object.isRequired,
+ updateTheme: React.PropTypes.func.isRequired
+};