Skip to content

Commit

Permalink
back to no theme / undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiggr committed Feb 3, 2023
1 parent 3c07ab0 commit e046c5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
21 changes: 5 additions & 16 deletions src/Widgets/ThemePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? (
<Form.Field
Expand Down Expand Up @@ -46,7 +35,7 @@ const ThemePicker = (props) => {
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
onChange(id, color.name);
handleChange(e, { value: color.name });
}}
active={value === color.name}
circular
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down

0 comments on commit e046c5f

Please sign in to comment.