@eeacms/volto-clms-theme 1.0.108 → 1.0.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,9 +4,18 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [1.0.109](https://github.com/eea/volto-clms-theme/compare/1.0.108...1.0.109)
8
+
9
+ - add ImageSizeWidget to fix volto-style-block incompatibility with Volto 15 [`15e4d97`](https://github.com/eea/volto-clms-theme/commit/15e4d9785aa3d34787ca151319aeaf8a4d8930b4)
10
+ - breadcrumbs on file views [`03ff26a`](https://github.com/eea/volto-clms-theme/commit/03ff26acf75090ebe61a71fb6f9c144548df1615)
11
+ - prettier [`b1f7295`](https://github.com/eea/volto-clms-theme/commit/b1f72954e990a789c84c6a4cc0764bbf98fcb6a2)
12
+ - email field style login popup and footer subscribe [`0561cb5`](https://github.com/eea/volto-clms-theme/commit/0561cb51cacb93f83c448ce82ef4079947942922)
13
+
7
14
  #### [1.0.108](https://github.com/eea/volto-clms-theme/compare/1.0.107...1.0.108)
8
15
 
9
- - EmailWidget fix [`cd56839`](https://github.com/eea/volto-clms-theme/commit/cd5683951ae27f7ceb51703593e898e33928bf0e)
16
+ > 18 July 2022
17
+
18
+ - EmailWidget fix [`#279`](https://github.com/eea/volto-clms-theme/pull/279)
10
19
 
11
20
  #### [1.0.107](https://github.com/eea/volto-clms-theme/compare/1.0.106...1.0.107)
12
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-clms-theme",
3
- "version": "1.0.108",
3
+ "version": "1.0.109",
4
4
  "description": "volto-clms-theme: Volto theme for CLMS site",
5
5
  "main": "src/index.js",
6
6
  "author": "CodeSyntax for the European Environment Agency",
@@ -1,18 +1,10 @@
1
- import React, { useEffect } from 'react';
2
-
1
+ import React from 'react';
3
2
  import CclButton from '@eeacms/volto-clms-theme/components/CclButton/CclButton';
4
- import { getBreadcrumbs } from '@plone/volto/actions';
5
- import { useDispatch } from 'react-redux';
6
- import { Label } from 'semantic-ui-react';
3
+ import { Label, Container } from 'semantic-ui-react';
7
4
 
8
5
  export const CLMSDownloadableFileView = (props) => {
9
- const dispatch = useDispatch();
10
6
  const { content } = props;
11
7
 
12
- useEffect(() => {
13
- dispatch(getBreadcrumbs([]));
14
- }, [dispatch]);
15
-
16
8
  const options = content.taxonomy_technical_library_categorization?.map(
17
9
  (cat) => {
18
10
  return {
@@ -26,26 +18,28 @@ export const CLMSDownloadableFileView = (props) => {
26
18
 
27
19
  return (
28
20
  <>
29
- <div id="page-document" className="ui container">
30
- <h1 className="page-title">{content.title}</h1>
31
- <div>
32
- <p>{content.description}</p>
21
+ <Container className="view-wrapper">
22
+ <div id="page-document" className="ui container">
23
+ <h1 className="page-title">{content.title}</h1>
24
+ <div>
25
+ <p>{content.description}</p>
26
+ </div>
27
+ {options?.length > 0 && (
28
+ <Label.Group>
29
+ {options.map((cat, key) => {
30
+ return (
31
+ <Label key={key} color="olive">
32
+ {cat.title}
33
+ </Label>
34
+ );
35
+ })}
36
+ </Label.Group>
37
+ )}{' '}
38
+ <CclButton download={true} url={content?.file?.download}>
39
+ Download file
40
+ </CclButton>
33
41
  </div>
34
- {options?.length > 0 && (
35
- <Label.Group>
36
- {options.map((cat, key) => {
37
- return (
38
- <Label key={key} color="olive">
39
- {cat.title}
40
- </Label>
41
- );
42
- })}
43
- </Label.Group>
44
- )}{' '}
45
- <CclButton download={true} url={content?.file?.download}>
46
- Download file
47
- </CclButton>
48
- </div>
42
+ </Container>
49
43
  </>
50
44
  );
51
45
  };
@@ -23,6 +23,11 @@
23
23
  margin-bottom: 1rem;
24
24
  }
25
25
 
26
+ .ui.tiny.modal {
27
+ width: 540px;
28
+ margin: 0em 0em 0em 0em !important;
29
+ }
30
+
26
31
  .modal-clms-container {
27
32
  position: relative;
28
33
  display: flex;
@@ -0,0 +1,93 @@
1
+ import React from 'react';
2
+ import { defineMessages, injectIntl } from 'react-intl';
3
+ import PropTypes from 'prop-types';
4
+ import { Button, Grid } from 'semantic-ui-react';
5
+ import { FormFieldWrapper } from '@plone/volto/components';
6
+
7
+ const messages = defineMessages({
8
+ small: {
9
+ id: 'Small',
10
+ defaultMessage: 'Small',
11
+ },
12
+ medium: {
13
+ id: 'Medium',
14
+ defaultMessage: 'Medium',
15
+ },
16
+ large: {
17
+ id: 'Large',
18
+ defaultMessage: 'Large',
19
+ },
20
+ });
21
+
22
+ const ImageSizeWidget = (props) => {
23
+ const { onChange, id, disabled, intl, value } = props;
24
+
25
+ return (
26
+ <FormFieldWrapper {...props}>
27
+ <Grid>
28
+ <Grid.Row>
29
+ <Grid.Column width="8" className="field-image_size">
30
+ <Button.Group>
31
+ <Button
32
+ icon
33
+ basic
34
+ aria-label={intl.formatMessage(messages.small)}
35
+ onClick={() => onChange(id, 's')}
36
+ active={value === 's'}
37
+ disabled={disabled}
38
+ >
39
+ <div className="image-sizes-text">S</div>
40
+ </Button>
41
+ </Button.Group>
42
+ <Button.Group>
43
+ <Button
44
+ icon
45
+ basic
46
+ aria-label={intl.formatMessage(messages.medium)}
47
+ onClick={() => onChange(id, 'm')}
48
+ active={value === 'm'}
49
+ disabled={disabled}
50
+ >
51
+ <div className="image-sizes-text">M</div>
52
+ </Button>
53
+ </Button.Group>
54
+ <Button.Group>
55
+ <Button
56
+ icon
57
+ basic
58
+ aria-label={intl.formatMessage(messages.large)}
59
+ onClick={() => onChange(id, 'l')}
60
+ active={value === 'l' || value === undefined}
61
+ disabled={disabled}
62
+ >
63
+ <div className="image-sizes-text">L</div>
64
+ </Button>
65
+ </Button.Group>
66
+ </Grid.Column>
67
+ </Grid.Row>
68
+ </Grid>
69
+ </FormFieldWrapper>
70
+ );
71
+ };
72
+
73
+ /**
74
+ * Property types.
75
+ * @property {Object} propTypes Property types.
76
+ * @static
77
+ */
78
+ ImageSizeWidget.propTypes = {
79
+ onChange: PropTypes.func.isRequired,
80
+ value: PropTypes.string,
81
+ id: PropTypes.string.isRequired,
82
+ };
83
+
84
+ /**
85
+ * Default properties.
86
+ * @property {Object} defaultProps Default properties.
87
+ * @static
88
+ */
89
+ ImageSizeWidget.defaultProps = {
90
+ onChange: () => {},
91
+ };
92
+
93
+ export default injectIntl(ImageSizeWidget);
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import renderer from 'react-test-renderer';
3
+ import configureStore from 'redux-mock-store';
4
+ import { Provider } from 'react-intl-redux';
5
+
6
+ import ImageSizeWidget from './ImageSizeWidget';
7
+
8
+ const mockStore = configureStore();
9
+
10
+ test('renders an image sizes widget component', () => {
11
+ const store = mockStore({
12
+ intl: {
13
+ locale: 'en',
14
+ messages: {},
15
+ },
16
+ });
17
+
18
+ const component = renderer.create(
19
+ <Provider store={store}>
20
+ <ImageSizeWidget
21
+ id="image_size"
22
+ title="Image Size"
23
+ fieldSet="default"
24
+ onChange={() => {}}
25
+ />
26
+ </Provider>,
27
+ );
28
+ const json = component.toJSON();
29
+ expect(json).toMatchSnapshot();
30
+ });
@@ -64,24 +64,25 @@ const EmailWidget = (props) => {
64
64
 
65
65
  return (
66
66
  <FormFieldWrapper {...props} className="email">
67
- <input
68
- className="ui input"
69
- id={inputId}
70
- name={id}
71
- type="email"
72
- value={value || ''}
73
- disabled={isDisabled}
74
- placeholder={placeholder}
75
- onChange={({ target }) =>
76
- onChange(id, target.value === '' ? undefined : target.value)
77
- }
78
- onBlur={({ target }) =>
79
- onBlur(id, target.value === '' ? undefined : target.value)
80
- }
81
- onClick={() => onClick()}
82
- minLength={minLength || null}
83
- maxLength={200}
84
- />
67
+ <div className="ui input">
68
+ <input
69
+ id={inputId}
70
+ name={id}
71
+ type="email"
72
+ value={value || ''}
73
+ disabled={isDisabled}
74
+ placeholder={placeholder}
75
+ onChange={({ target }) =>
76
+ onChange(id, target.value === '' ? undefined : target.value)
77
+ }
78
+ onBlur={({ target }) =>
79
+ onBlur(id, target.value === '' ? undefined : target.value)
80
+ }
81
+ onClick={() => onClick()}
82
+ minLength={minLength || null}
83
+ maxLength={200}
84
+ />
85
+ </div>
85
86
  </FormFieldWrapper>
86
87
  );
87
88
  };
@@ -142,9 +142,7 @@ class Footer extends Component {
142
142
 
143
143
  handleInputChange() {
144
144
  this.setState({
145
- inputValue: validator.isEmail(this.state.value)
146
- ? !this.state.inputValue
147
- : this.state.inputValue,
145
+ inputValue: !this.state.inputValue,
148
146
  });
149
147
  }
150
148
 
package/src/index.js CHANGED
@@ -33,6 +33,8 @@ import MapLayersWidget from './components/Widgets/MapLayersWidget';
33
33
  import TabsWidget from './components/Blocks/CustomTemplates/VoltoTabsBlock/TabsWidget';
34
34
  import TaxonomyWidget from './components/Widgets/TaxonomyWidget';
35
35
  import ProductComponentsWidget from './components/Widgets/ProductComponentsWidget';
36
+ import ImageSizeWidget from './components/Widgets/ImageSizeWidget';
37
+
36
38
  // CUSTOM REDUCERS IMPORT
37
39
  import TextLinkWidget from './components/Widgets/TextLinkWidget';
38
40
 
@@ -78,6 +80,7 @@ const applyConfig = (config) => {
78
80
  geonetwork_identifiers_widget: GeonetworkIdentifiersWidget,
79
81
  text_link_widget: TextLinkWidget,
80
82
  dataset_download_information_widget: DatasetDownloadInformationWidget,
83
+ image_size: ImageSizeWidget,
81
84
  };
82
85
  config.widgets.id = {
83
86
  ...config.widgets.id,