@eeacms/volto-eea-website-theme 1.6.1 → 1.6.2

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,11 +4,25 @@ 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.6.1](https://github.com/eea/volto-eea-website-theme/compare/1.6.0...1.6.1) - 25 January 2023
7
+ ### [1.6.2](https://github.com/eea/volto-eea-website-theme/compare/1.6.1...1.6.2) - 27 January 2023
8
+
9
+ #### :bug: Bug Fixes
10
+
11
+ - fix(banner): properly pass image source to banner [David Ichim - [`465e616`](https://github.com/eea/volto-eea-website-theme/commit/465e61651eeb3abd05ac1b8fda2d754b59d28faa)]
12
+ - fix(cypress): use force click [nileshgulia1 - [`3c8db52`](https://github.com/eea/volto-eea-website-theme/commit/3c8db5271fea819fdeebda9773d376abf498759a)]
13
+ - fix(eslint): remove warning [nileshgulia1 - [`d01a1da`](https://github.com/eea/volto-eea-website-theme/commit/d01a1da6b5fb10c8774fdfb962310be95f9a5690)]
14
+
15
+ #### :nail_care: Enhancements
16
+
17
+ - refactor(banner): sync storybook and Volto component #76 from eea/sync-page-banner-theme [ichim-david - [`fad29fb`](https://github.com/eea/volto-eea-website-theme/commit/fad29fb4581c640a27e14743803eadb63ff67334)]
18
+ - change(banner): removed container wrapper since it was moved inside banner component [David Ichim - [`5cf9c3b`](https://github.com/eea/volto-eea-website-theme/commit/5cf9c3bc9f443ee45f234744a1a4c589420e3815)]
19
+ - refactor(banner): sync storybook and Volto component [nileshgulia1 - [`d2d6a61`](https://github.com/eea/volto-eea-website-theme/commit/d2d6a617f5d270768448bc3f0637c5aea60d70f2)]
8
20
 
9
21
  #### :hammer_and_wrench: Others
10
22
 
11
- - Upgrade design system dependency to alpha 12 [Alin Voinea - [`2166893`](https://github.com/eea/volto-eea-website-theme/commit/2166893112f85f6965a4eafc694ec0e2f21cda57)]
23
+ - remove(banner): shift banner title css to design system [nileshgulia1 - [`aff9f74`](https://github.com/eea/volto-eea-website-theme/commit/aff9f74f5e9ce858b4eeaf6b02cee9b5c61813a9)]
24
+ ### [1.6.1](https://github.com/eea/volto-eea-website-theme/compare/1.6.0...1.6.1) - 25 January 2023
25
+
12
26
  ### [1.6.0](https://github.com/eea/volto-eea-website-theme/compare/1.5.1...1.6.0) - 17 January 2023
13
27
 
14
28
  ### [1.5.1](https://github.com/eea/volto-eea-website-theme/compare/1.5.0...1.5.1) - 13 January 2023
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "@eeacms/volto-eea-website-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -5,10 +5,13 @@ import { withRouter } from 'react-router';
5
5
  import { defineMessages, injectIntl } from 'react-intl';
6
6
  import { startCase } from 'lodash';
7
7
  import qs from 'querystring';
8
- import { Container, Popup, Icon } from 'semantic-ui-react';
8
+ import { Popup, Icon } from 'semantic-ui-react';
9
9
  import { flattenToAppURL } from '@plone/volto/helpers';
10
- import Banner from './Banner';
11
- import { getImageSource, sharePage } from './Banner';
10
+ import Banner from '@eeacms/volto-eea-design-system/ui/Banner/Banner';
11
+ import {
12
+ getImageSource,
13
+ sharePage,
14
+ } from '@eeacms/volto-eea-design-system/ui/Banner/Banner';
12
15
  import Copyright from '@eeacms/volto-eea-design-system/ui/Copyright/Copyright';
13
16
 
14
17
  import './styles.less';
@@ -57,11 +60,6 @@ const friendlyId = (id) => {
57
60
  return startCase(id);
58
61
  };
59
62
 
60
- const ContainerWrapper = ({ fluid, children }) => {
61
- if (fluid) return <React.Fragment>{children}</React.Fragment>;
62
- return <Container>{children}</Container>;
63
- };
64
-
65
63
  const Title = ({ config = {}, properties }) => {
66
64
  const view = useMemo(() => {
67
65
  return config.view;
@@ -74,7 +72,7 @@ const Title = ({ config = {}, properties }) => {
74
72
  };
75
73
 
76
74
  const View = (props) => {
77
- const { banner = {}, fluid, intl, location, types = [] } = props;
75
+ const { banner = {}, intl, location, types = [] } = props;
78
76
  const metadata = props.metadata || props.properties;
79
77
  const {
80
78
  info = [],
@@ -113,6 +111,7 @@ const View = (props) => {
113
111
  () => getDate(hideModificationDate, 'modified'),
114
112
  [getDate, hideModificationDate],
115
113
  );
114
+
116
115
  // Set image source
117
116
  const image = getImageSource(metadata['image']);
118
117
  // Get type
@@ -130,116 +129,106 @@ const View = (props) => {
130
129
  }, [types, metadata, parameters]);
131
130
 
132
131
  return (
133
- <Banner {...props}>
134
- <div
135
- className={image ? 'image' : ''}
136
- style={image ? { backgroundImage: `url(${image})` } : {}}
137
- >
138
- <div className="gradient">
139
- <ContainerWrapper fluid={fluid}>
140
- <Banner.Content
141
- actions={
142
- <>
143
- {!hideShareButton && (
144
- <Popup
145
- className="share-popup"
146
- content={() => (
147
- <>
148
- <p>{intl.formatMessage(messages.share_to)}</p>
149
- <div className="actions">
150
- <Banner.Action
151
- icon="ri-facebook-fill"
152
- onClick={() => {
153
- sharePage(metadata['@id'], 'facebook');
154
- }}
155
- />
156
- <Banner.Action
157
- icon="ri-twitter-fill"
158
- onClick={() => {
159
- sharePage(metadata['@id'], 'twitter');
160
- }}
161
- />
162
- <Banner.Action
163
- icon="ri-linkedin-fill"
164
- onClick={() => {
165
- sharePage(metadata['@id'], 'linkedin');
166
- }}
167
- />
168
- </div>
169
- </>
170
- )}
171
- position="bottom center"
172
- size="small"
173
- trigger={
174
- <Banner.Action
175
- icon="ri-share-fill"
176
- title={intl.formatMessage(messages.share)}
177
- className="share"
178
- onClick={() => {}}
179
- />
180
- }
181
- />
182
- )}
183
- {!hideDownloadButton && (
184
- <Banner.Action
185
- icon="ri-download-2-fill"
186
- title={intl.formatMessage(messages.download)}
187
- className="download"
188
- onClick={() => {
189
- window.print();
190
- }}
191
- />
192
- )}
193
- </>
194
- }
195
- >
196
- <Title config={banner.title} properties={metadata} />
197
- <Banner.Metadata>
198
- <Banner.MetadataField
199
- type="type"
200
- hidden={hideContentType}
201
- // value={contentType || properties['@type'] || parameters.type}
202
- value={type}
203
- />
204
- <Banner.MetadataField
205
- type="date"
206
- label={intl.formatMessage(messages.created)}
207
- value={creationDate}
208
- title={`${intl.formatMessage(messages.created_on)} {}`}
209
- />
210
- <Banner.MetadataField
211
- type="date"
212
- label={intl.formatMessage(messages.published)}
213
- value={publishingDate}
214
- title={`${intl.formatMessage(messages.published_on)} {}`}
215
- />
216
- <Banner.MetadataField
217
- type="date"
218
- label={intl.formatMessage(messages.modified)}
219
- value={modificationDate}
220
- title={`${intl.formatMessage(messages.modified_on)} {}`}
221
- />
222
- {info.map((item, index) => (
223
- <Banner.MetadataField
224
- key={`header-info-${index}`}
225
- value={item.description}
132
+ <Banner {...props} image={image}>
133
+ <Banner.Content
134
+ actions={
135
+ <>
136
+ {!hideShareButton && (
137
+ <Popup
138
+ className="share-popup"
139
+ content={() => (
140
+ <>
141
+ <p>{intl.formatMessage(messages.share_to)}</p>
142
+ <div className="actions">
143
+ <Banner.Action
144
+ icon="ri-facebook-fill"
145
+ onClick={() => {
146
+ sharePage(metadata['@id'], 'facebook');
147
+ }}
148
+ />
149
+ <Banner.Action
150
+ icon="ri-twitter-fill"
151
+ onClick={() => {
152
+ sharePage(metadata['@id'], 'twitter');
153
+ }}
154
+ />
155
+ <Banner.Action
156
+ icon="ri-linkedin-fill"
157
+ onClick={() => {
158
+ sharePage(metadata['@id'], 'linkedin');
159
+ }}
160
+ />
161
+ </div>
162
+ </>
163
+ )}
164
+ position="bottom center"
165
+ size="small"
166
+ trigger={
167
+ <Banner.Action
168
+ icon="ri-share-fill"
169
+ title={intl.formatMessage(messages.share)}
170
+ className="share"
171
+ onClick={() => {}}
226
172
  />
227
- ))}
228
- </Banner.Metadata>
229
- {copyright ? (
230
- <Copyright copyrightPosition={copyrightPosition}>
231
- <Copyright.Icon>
232
- <Icon className={copyrightIcon} />
233
- </Copyright.Icon>
234
- <Copyright.Text>{copyright}</Copyright.Text>
235
- </Copyright>
236
- ) : (
237
- ''
238
- )}
239
- </Banner.Content>
240
- </ContainerWrapper>
241
- </div>
242
- </div>
173
+ }
174
+ />
175
+ )}
176
+ {!hideDownloadButton && (
177
+ <Banner.Action
178
+ icon="ri-download-2-fill"
179
+ title={intl.formatMessage(messages.download)}
180
+ className="download"
181
+ onClick={() => {
182
+ window.print();
183
+ }}
184
+ />
185
+ )}
186
+ </>
187
+ }
188
+ >
189
+ <Title config={banner.title} properties={metadata} />
190
+ <Banner.Metadata>
191
+ <Banner.MetadataField
192
+ type="type"
193
+ hidden={hideContentType}
194
+ value={type}
195
+ />
196
+ <Banner.MetadataField
197
+ type="date"
198
+ label={intl.formatMessage(messages.created)}
199
+ value={creationDate}
200
+ title={`${intl.formatMessage(messages.created_on)} {}`}
201
+ />
202
+ <Banner.MetadataField
203
+ type="date"
204
+ label={intl.formatMessage(messages.published)}
205
+ value={publishingDate}
206
+ title={`${intl.formatMessage(messages.published_on)} {}`}
207
+ />
208
+ <Banner.MetadataField
209
+ type="date"
210
+ label={intl.formatMessage(messages.modified)}
211
+ value={modificationDate}
212
+ title={`${intl.formatMessage(messages.modified_on)} {}`}
213
+ />
214
+ {info.map((item, index) => (
215
+ <Banner.MetadataField
216
+ key={`header-info-${index}`}
217
+ value={item.description}
218
+ />
219
+ ))}
220
+ </Banner.Metadata>
221
+ {copyright ? (
222
+ <Copyright copyrightPosition={copyrightPosition}>
223
+ <Copyright.Icon>
224
+ <Icon className={copyrightIcon} />
225
+ </Copyright.Icon>
226
+ <Copyright.Text>{copyright}</Copyright.Text>
227
+ </Copyright>
228
+ ) : (
229
+ ''
230
+ )}
231
+ </Banner.Content>
243
232
  </Banner>
244
233
  );
245
234
  };
@@ -3,15 +3,6 @@
3
3
  padding-left: 1rem;
4
4
  }
5
5
 
6
- .eea.banner .documentFirstHeading {
7
- border-bottom: none;
8
- margin-bottom: 0;
9
-
10
- &::before {
11
- content: none;
12
- }
13
- }
14
-
15
6
  .share-popup {
16
7
  .actions {
17
8
  display: flex;
package/src/index.js CHANGED
@@ -139,6 +139,15 @@ const applyConfig = (config) => {
139
139
  // Custom block-style colors
140
140
  config.settings.available_colors = eea.colors;
141
141
 
142
+ // Site theme colors
143
+
144
+ config.settings.themeColors = [
145
+ { value: 'default', title: 'Default' },
146
+ { value: 'primary', title: 'Primary' },
147
+ { value: 'secondary', title: 'Secondary' },
148
+ { value: 'tertiary', title: 'Tertiary' },
149
+ ];
150
+
142
151
  // Custom block styles
143
152
  config.settings.previewText = '';
144
153
  config.settings.pluggableStyles = [
@@ -1,99 +0,0 @@
1
- import React from 'react';
2
- import { compose } from 'redux';
3
- import { connect } from 'react-redux';
4
- import { Icon, Button, Grid } from 'semantic-ui-react';
5
- import { formatDate } from '@plone/volto/helpers/Utils/Date';
6
- import config from '@plone/volto/registry';
7
-
8
- const socialPlatforms = {
9
- facebook: {
10
- shareLink: (url) => `https://facebook.com/sharer.php?u=${url}`,
11
- },
12
- twitter: {
13
- shareLink: (url) => `https://www.twitter.com/share?url=${url}`,
14
- },
15
- linkedin: {
16
- shareLink: (url) =>
17
- `https://www.linkedin.com/sharing/share-offsite/?url=${url}`,
18
- },
19
- reddit: {
20
- shareLink: (url, title) => `https://reddit.com/submit?url=${url}`,
21
- },
22
- };
23
-
24
- export const getImageSource = (image) => {
25
- if (image?.download) return image.download;
26
- if (image?.encoding)
27
- return `data:${image['content-type']};${image['encoding']},${image['data']}`;
28
- return null;
29
- };
30
-
31
- export const sharePage = (url, platform) => {
32
- if (!socialPlatforms[platform]) return;
33
- const link = document.createElement('a');
34
- link.setAttribute('href', socialPlatforms[platform].shareLink(url));
35
- link.setAttribute('target', '_blank');
36
- link.setAttribute('rel', 'noreferrer');
37
- link.click();
38
- };
39
-
40
- const Banner = ({ children }) => {
41
- return <div className="eea banner">{children}</div>;
42
- };
43
-
44
- Banner.Action = ({ title, icon, color, onClick, className }) => {
45
- return (
46
- <div className="action">
47
- <Button className={className} basic icon inverted onClick={onClick}>
48
- <Icon className={icon} color={color}></Icon>
49
- <span className="mobile hidden">{title}</span>
50
- </Button>
51
- </div>
52
- );
53
- };
54
-
55
- Banner.Content = ({ children, actions }) => {
56
- return (
57
- <div className="content">
58
- <Grid>
59
- <Grid.Column mobile={10} tablet={9} computer={9}>
60
- {children}
61
- </Grid.Column>
62
- <Grid.Column mobile={2} tablet={3} computer={3} className="actions">
63
- {actions}
64
- </Grid.Column>
65
- </Grid>
66
- </div>
67
- );
68
- };
69
-
70
- Banner.Title = ({ children }) => (
71
- <h1 className="documentFirstHeading">{children}</h1>
72
- );
73
- Banner.Metadata = ({ children }) => <p className="metadata">{children}</p>;
74
- Banner.MetadataField = ({ hidden, type = 'text', label, value, title }) => {
75
- const locale = config.settings.dateLocale || 'en-gb';
76
- if (hidden || !value) return '';
77
- if (type === 'date' && value)
78
- return (
79
- <span className={`field ${type}`} title={title.replace('{}', value)}>
80
- {label}{' '}
81
- {formatDate({
82
- date: value,
83
- format: {
84
- year: 'numeric',
85
- month: 'short',
86
- day: '2-digit',
87
- },
88
- locale: locale,
89
- })}
90
- </span>
91
- );
92
- return <span className={`field ${type}`}>{value}</span>;
93
- };
94
-
95
- export default compose(
96
- connect((state) => ({
97
- content: state.content.data,
98
- })),
99
- )(Banner);