Skip to content

Commit

Permalink
Merge pull request #3 from eea/develop
Browse files Browse the repository at this point in the history
Fix scrolling to top of the form when switching theme value from undefined to something else
  • Loading branch information
avoinea committed Feb 3, 2023
2 parents 3ffe18e + 3c07ab0 commit 22892b7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [1.0.2](https://github.com/eea/volto-widget-theme-picker/compare/1.0.1...1.0.2) - 3 February 2023

#### :hammer_and_wrench: Others

- no-theme is default [andreiggr - [`1978f76`](https://github.com/eea/volto-widget-theme-picker/commit/1978f769b044bdf1632a4dd1f3069c4ddee6fb2a)]
- fix scrolling to top of form when switching from undefined value to some value [andreiggr - [`877d385`](https://github.com/eea/volto-widget-theme-picker/commit/877d38518338d62ab57a68f75521e6a0863e44cd)]
- removed default theme in favor of no theme value [ichim-david - [`baa5b83`](https://github.com/eea/volto-widget-theme-picker/commit/baa5b83e7c74abc6d156f3b7ce6bf30b58d1895d)]
### [1.0.1](https://github.com/eea/volto-widget-theme-picker/compare/1.0.0...1.0.1) - 31 January 2023

#### :hammer_and_wrench: Others

- update volto addon template to theme picker [andreiggr - [`370e76e`](https://github.com/eea/volto-widget-theme-picker/commit/370e76e3817ae83d736655a7f71f233963ad2a24)]
- update package json [Andrei Grigore - [`e7e673b`](https://github.com/eea/volto-widget-theme-picker/commit/e7e673b2c805dd5be1dbf23a39e1c92eeea3abba)]
- 1.0.0 release [Andrei Grigore - [`7c232dd`](https://github.com/eea/volto-widget-theme-picker/commit/7c232dde42ab42452b81374afa980834fe5ad533)]
### 1.0.0 - 26 January 2023

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-widget-theme-picker",
"version": "1.0.1",
"version": "1.0.2",
"description": "@eeacms/volto-widget-theme-picker: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
15 changes: 12 additions & 3 deletions src/Widgets/ThemePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ import { Form } from 'semantic-ui-react';
import { Grid, Button } from 'semantic-ui-react';

const ThemePicker = (props) => {
const { id, title, required, value, onChange, colors, className } = props;
const {
id,
title,
required,
defaultValue = 'default',
value,
onChange,
colors,
className,
} = props;

React.useEffect(() => {
if (!props.value && props.default) {
props.onChange(props.id, props.default);
if (!value && defaultValue) {
onChange(id, defaultValue);
}
});

Expand Down

0 comments on commit 22892b7

Please sign in to comment.