From ad60980acf48be3494797104844c7f2fe5b78e66 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 20 Apr 2020 20:33:27 -0500 Subject: [PATCH] Refactor theme selector dropdown --- app/gabsocial/features/forms/index.js | 38 ++++++++++++++++++ app/gabsocial/features/preferences/index.js | 43 +++++++-------------- 2 files changed, 52 insertions(+), 29 deletions(-) diff --git a/app/gabsocial/features/forms/index.js b/app/gabsocial/features/forms/index.js index d8a801d9a..148e467cd 100644 --- a/app/gabsocial/features/forms/index.js +++ b/app/gabsocial/features/forms/index.js @@ -146,3 +146,41 @@ export class RadioItem extends ImmutablePureComponent { } } + +export class SelectDropdown extends ImmutablePureComponent { + + static propTypes = { + label: PropTypes.string, + items: PropTypes.object.isRequired, + defaultValue: PropTypes.string, + onChange: PropTypes.func, + } + + render() { + const { label, items, defaultValue, onChange } = this.props; + const id = uuidv4(); + + return ( +
+
+ +
+ +
+
+
+ ); + } + +} diff --git a/app/gabsocial/features/preferences/index.js b/app/gabsocial/features/preferences/index.js index 130b3e34f..869983673 100644 --- a/app/gabsocial/features/preferences/index.js +++ b/app/gabsocial/features/preferences/index.js @@ -11,6 +11,7 @@ import { FieldsGroup, RadioGroup, RadioItem, + SelectDropdown, } from 'gabsocial/features/forms'; import SettingsCheckbox from './components/settings_checkbox'; @@ -20,14 +21,14 @@ const messages = defineMessages({ // TODO: Pull dynamically const themes = { - cobalt: 'cobalt', - 'gabsocial-light': 'Light', - default: 'Dark', - contrast: 'High contrast', + cobalt: 'Cobalt', + 'gabsocial-light': 'Purple Light', + default: 'Purple Dark', + contrast: 'Purple Contrast', halloween: 'Halloween', - neenster: 'neenster', - glinner: 'glinner', - lime: 'lime', + neenster: 'Aquatic', + glinner: 'Pale Blue', + lime: 'Lime Green', }; const mapStateToProps = state => ({ @@ -71,28 +72,13 @@ class Preferences extends ImmutablePureComponent { return ( - -
-
- -
- -
-
-
+
@@ -132,7 +118,6 @@ class Preferences extends ImmutablePureComponent { path={['deleteModal']} /> -
);