From e046c5fb332180a4dd43d07512284c6be8d8a0ed Mon Sep 17 00:00:00 2001 From: andreiggr Date: Fri, 3 Feb 2023 15:36:47 +0200 Subject: [PATCH] back to no theme / undefined --- src/Widgets/ThemePicker.jsx | 21 +++++---------------- src/index.js | 2 +- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/Widgets/ThemePicker.jsx b/src/Widgets/ThemePicker.jsx index f9ef0e2..c9face2 100644 --- a/src/Widgets/ThemePicker.jsx +++ b/src/Widgets/ThemePicker.jsx @@ -3,22 +3,11 @@ import { Form } from 'semantic-ui-react'; import { Grid, Button } from 'semantic-ui-react'; const ThemePicker = (props) => { - const { - id, - title, - required, - defaultValue = 'default', - value, - onChange, - colors, - className, - } = props; + const { id, title, required, value, onChange, colors, className } = props; - React.useEffect(() => { - if (!value && defaultValue) { - onChange(id, defaultValue); - } - }); + const handleChange = (e, { value }) => { + onChange(id, value); + }; return colors && colors.length > 0 ? ( { onClick={(e) => { e.preventDefault(); e.stopPropagation(); - onChange(id, color.name); + handleChange(e, { value: color.name }); }} active={value === color.name} circular diff --git a/src/index.js b/src/index.js index 991edaf..c265fd9 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,7 @@ const applyConfig = (config) => { config.widgets.widget.theme_picker = ThemePickerWidget; config.settings.themeColors = [ - { value: 'default', title: 'Default' }, + { value: undefined, title: 'No theme' }, { value: 'primary', title: 'Primary' }, { value: 'secondary', title: 'Secondary' }, { value: 'tertiary', title: 'Tertiary' },