diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-02-16 08:19:19 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-02-16 08:19:19 -0500 |
commit | 6ffcfaa2f38cfb4d4f354c547286d8e29b6efda6 (patch) | |
tree | 670551eadc5008231bb1b838edf3fea01d968ad2 /web/react/components/user_settings | |
parent | 2ec3762fb2e0140649d138006323b35726b9b213 (diff) | |
parent | 44fa72066bacb741c3303633b6a3a690f6fc0d01 (diff) | |
download | chat-6ffcfaa2f38cfb4d4f354c547286d8e29b6efda6.tar.gz chat-6ffcfaa2f38cfb4d4f354c547286d8e29b6efda6.tar.bz2 chat-6ffcfaa2f38cfb4d4f354c547286d8e29b6efda6.zip |
Merge pull request #2171 from asaadmahmoodspin/ui-fixes
Multiple UI Improvements
Diffstat (limited to 'web/react/components/user_settings')
-rw-r--r-- | web/react/components/user_settings/custom_theme_chooser.jsx | 113 | ||||
-rw-r--r-- | web/react/components/user_settings/user_settings_theme.jsx | 2 |
2 files changed, 106 insertions, 9 deletions
diff --git a/web/react/components/user_settings/custom_theme_chooser.jsx b/web/react/components/user_settings/custom_theme_chooser.jsx index 2d88a3650..1e724bb6e 100644 --- a/web/react/components/user_settings/custom_theme_chooser.jsx +++ b/web/react/components/user_settings/custom_theme_chooser.jsx @@ -102,6 +102,7 @@ class CustomThemeChooser extends React.Component { this.onPickerChange = this.onPickerChange.bind(this); this.onInputChange = this.onInputChange.bind(this); this.pasteBoxChange = this.pasteBoxChange.bind(this); + this.toggleContent = this.toggleContent.bind(this); this.state = {}; } @@ -153,11 +154,23 @@ class CustomThemeChooser extends React.Component { this.props.updateTheme(theme); } + toggleContent(e) { + e.stopPropagation(); + if ($(e.target).hasClass('theme-elements__header')) { + $(e.target).next().slideToggle(); + $(e.target).toggleClass('open'); + } else { + $(e.target).closest('.theme-elements__header').next().slideToggle(); + $(e.target).closest('.theme-elements__header').toggleClass('open'); + } + } render() { const {formatMessage} = this.props.intl; const theme = this.props.theme; - const elements = []; + const sidebarElements = []; + const centerChannelElements = []; + const linkAndButtonElements = []; let colors = ''; Constants.THEME_ELEMENTS.forEach((element, index) => { if (element.id === 'codeTheme') { @@ -187,9 +200,9 @@ class CustomThemeChooser extends React.Component { </Popover> ); - elements.push( + centerChannelElements.push( <div - className='col-sm-4 form-group' + className='col-sm-6 form-group' key={'custom-theme-key' + index} > <label className='custom-label'>{formatMessage(messages[element.id])}</label> @@ -219,10 +232,54 @@ class CustomThemeChooser extends React.Component { </div> </div> ); + } else if (element.group === 'centerChannelElements') { + centerChannelElements.push( + <div + className='col-sm-6 form-group element' + key={'custom-theme-key' + index} + > + <label className='custom-label'>{formatMessage(messages[element.id])}</label> + <div + className='input-group color-picker' + id={element.id} + > + <input + className='form-control' + type='text' + value={theme[element.id]} + onChange={this.onInputChange} + /> + <span className='input-group-addon'><i></i></span> + </div> + </div> + ); + } else if (element.group === 'sidebarElements') { + sidebarElements.push( + <div + className='col-sm-6 form-group element' + key={'custom-theme-key' + index} + > + <label className='custom-label'>{formatMessage(messages[element.id])}</label> + <div + className='input-group color-picker' + id={element.id} + > + <input + className='form-control' + type='text' + value={theme[element.id]} + onChange={this.onInputChange} + /> + <span className='input-group-addon'><i></i></span> + </div> + </div> + ); + + colors += theme[element.id] + ','; } else { - elements.push( + linkAndButtonElements.push( <div - className='col-sm-4 form-group element' + className='col-sm-6 form-group element' key={'custom-theme-key' + index} > <label className='custom-label'>{formatMessage(messages[element.id])}</label> @@ -265,9 +322,51 @@ class CustomThemeChooser extends React.Component { ); return ( - <div className='appearance-section'> + <div className='appearance-section padding-top'> + <div className='theme-elements row'> + <div + className='theme-elements__header' + onClick={this.toggleContent} + > + {'Sidebar Styles'} + <div className='header__icon'> + <i className='fa fa-plus'></i> + <i className='fa fa-minus'></i> + </div> + </div> + <div className='theme-elements__body'> + {sidebarElements} + </div> + </div> + <div className='theme-elements row'> + <div + className='theme-elements__header' + onClick={this.toggleContent} + > + {'Center Channel Styles'} + <div className='header__icon'> + <i className='fa fa-plus'></i> + <i className='fa fa-minus'></i> + </div> + </div> + <div className='theme-elements__body'> + {centerChannelElements} + </div> + </div> <div className='theme-elements row form-group'> - {elements} + <div + className='theme-elements__header' + onClick={this.toggleContent} + > + {'Link and Button Styles'} + <div className='header__icon'> + <i className='fa fa-plus'></i> + <i className='fa fa-minus'></i> + </div> + </div> + <div className='theme-elements__body'> + {linkAndButtonElements} + </div> </div> <div className='row'> {pasteBox} diff --git a/web/react/components/user_settings/user_settings_theme.jsx b/web/react/components/user_settings/user_settings_theme.jsx index 34c688db1..74975d115 100644 --- a/web/react/components/user_settings/user_settings_theme.jsx +++ b/web/react/components/user_settings/user_settings_theme.jsx @@ -182,7 +182,6 @@ export default class ThemeSetting extends React.Component { if (displayCustom) { custom = ( <div key='customThemeChooser'> - <br/> <CustomThemeChooser theme={this.state.theme} updateTheme={this.updateTheme} @@ -241,7 +240,6 @@ export default class ThemeSetting extends React.Component { defaultMessage='Custom Theme' /> </label> - <br/> </div> ); |