blob: 9552c686d1ac4ed59e27821a948903f3f3a85552 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import $ from 'jquery';
import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
import React from 'react';
import {FormattedMessage} from 'react-intl';
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-xs-6 col-sm-3 premade-themes'
key={'premade-theme-key' + k}
>
<div
className={activeClass}
onClick={() => this.props.updateTheme(premadeTheme)}
>
<label>
<img
className='img-responsive'
src={premadeTheme.image}
/>
<div className='theme-label'>{Utils.toTitleCase(premadeTheme.type)}</div>
</label>
</div>
</div>
);
}
}
return (
<div className='row appearance-section'>
<div className='clearfix'>
{premadeThemes}
</div>
<div className='clearfix'>
<div className='col-sm-12 padding-bottom x2'>
<a
href='http://docs.mattermost.com/help/settings/theme-colors.html#custom-theme-examples'
target='_blank'
rel='noopener noreferrer'
>
<FormattedMessage
id='user.settings.display.theme.otherThemes'
defaultMessage='See other themes'
/>
</a>
</div>
</div>
</div>
);
}
}
PremadeThemeChooser.propTypes = {
theme: React.PropTypes.object.isRequired,
updateTheme: React.PropTypes.func.isRequired
};
|