diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2015-10-30 09:21:53 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2015-10-30 09:21:53 -0400 |
commit | c2cd58a33f52c6567e39d8ba563425dc06916d41 (patch) | |
tree | 492f80236bf30aa05514f1428296cf6b0432f435 /web/react/components/user_settings/code_theme_chooser.jsx | |
parent | b686e51cfde4c50fba8e2797a532c8813ee8aade (diff) | |
parent | d630567c91d01d5b78be84ac1a5e638e4e72516c (diff) | |
download | chat-c2cd58a33f52c6567e39d8ba563425dc06916d41.tar.gz chat-c2cd58a33f52c6567e39d8ba563425dc06916d41.tar.bz2 chat-c2cd58a33f52c6567e39d8ba563425dc06916d41.zip |
Merge pull request #1220 from florianorben/PLT-395
PLT-395: Add syntax highlighting to Markdown code blocks
Diffstat (limited to 'web/react/components/user_settings/code_theme_chooser.jsx')
-rw-r--r-- | web/react/components/user_settings/code_theme_chooser.jsx | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/web/react/components/user_settings/code_theme_chooser.jsx b/web/react/components/user_settings/code_theme_chooser.jsx new file mode 100644 index 000000000..eef4b24ba --- /dev/null +++ b/web/react/components/user_settings/code_theme_chooser.jsx @@ -0,0 +1,55 @@ +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +var Constants = require('../../utils/constants.jsx'); + +export default class CodeThemeChooser extends React.Component { + constructor(props) { + super(props); + this.state = {}; + } + render() { + const theme = this.props.theme; + + const premadeThemes = []; + for (const k in Constants.CODE_THEMES) { + if (Constants.CODE_THEMES.hasOwnProperty(k)) { + let activeClass = ''; + if (k === theme.codeTheme) { + activeClass = 'active'; + } + + premadeThemes.push( + <div + className='col-xs-6 col-sm-3 premade-themes' + key={'premade-theme-key' + k} + > + <div + className={activeClass} + onClick={() => this.props.updateTheme(k)} + > + <label> + <img + className='img-responsive' + src={'/static/images/themes/code_themes/' + k + '.png'} + /> + <div className='theme-label'>{Constants.CODE_THEMES[k]}</div> + </label> + </div> + </div> + ); + } + } + + return ( + <div className='row'> + {premadeThemes} + </div> + ); + } +} + +CodeThemeChooser.propTypes = { + theme: React.PropTypes.object.isRequired, + updateTheme: React.PropTypes.func.isRequired +}; |