@eeacms/volto-eea-website-theme 0.5.2 → 0.6.0

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,8 +4,39 @@ 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
+ #### [0.6.0](https://github.com/eea/volto-eea-website-theme/compare/0.5.4...0.6.0)
8
+
9
+ - Cleanup [`415014b`](https://github.com/eea/volto-eea-website-theme/commit/415014b8399de5ffb5afaa9d6440b4ea5fe2bf2a)
10
+ - Release 0.6.0 [`1253ebb`](https://github.com/eea/volto-eea-website-theme/commit/1253ebba2f1c88dbc6b77a135580f3a5d7752729)
11
+ - fix(comments): Replace moment with formatRelativeDate helper from Volto core [`9b7974a`](https://github.com/eea/volto-eea-website-theme/commit/9b7974adb3d01065b80f61d7c3c1c09a93199ee6)
12
+ - fix(seo): SSR Title block [`887edc2`](https://github.com/eea/volto-eea-website-theme/commit/887edc25e45c44bfe99b909ae87c7fb7a90278a6)
13
+ - Remove quote block customization [`4d459f5`](https://github.com/eea/volto-eea-website-theme/commit/4d459f57265c5b0b1e6ff8472e4f0350a888ca04)
14
+
15
+ #### [0.5.4](https://github.com/eea/volto-eea-website-theme/compare/0.5.3...0.5.4)
16
+
17
+ > 17 May 2022
18
+
19
+ - Release [`#25`](https://github.com/eea/volto-eea-website-theme/pull/25)
20
+ - Add customization to volto-quote-block icons [`#23`](https://github.com/eea/volto-eea-website-theme/pull/23)
21
+ - change (theme): added quote and callout components [`b691da2`](https://github.com/eea/volto-eea-website-theme/commit/b691da29236440a1096fcbf38d9d9e6cc6e69445)
22
+ - change(banner): added icon class to banner buttons [`7b641cf`](https://github.com/eea/volto-eea-website-theme/commit/7b641cfdc433fd638ff8ba2c3f4b9131a9f8142a)
23
+
24
+ #### [0.5.3](https://github.com/eea/volto-eea-website-theme/compare/0.5.2...0.5.3)
25
+
26
+ > 22 April 2022
27
+
28
+ - Release [`#24`](https://github.com/eea/volto-eea-website-theme/pull/24)
29
+ - Apply Draft bg only on View [`8910d78`](https://github.com/eea/volto-eea-website-theme/commit/8910d78baf0663d9eb820a3846ae24dea8eaa674)
30
+ - lint fixes [`ffc9edd`](https://github.com/eea/volto-eea-website-theme/commit/ffc9edd7dd90033d9ed8ccbe17c5327e68128b6f)
31
+ - change(buttons): customized Form, Sharing and ObjectBrowserWidget.jsx [`c307131`](https://github.com/eea/volto-eea-website-theme/commit/c307131f911dc05c2a9ef7d9c79357cd85de0fc4)
32
+ - change(ModalForm): added circular class to modal action buttons [`c418021`](https://github.com/eea/volto-eea-website-theme/commit/c418021da30aee28113edecea53ebd9d2316dfcd)
33
+ - Improved Title block banner + add social icons [`eeb049b`](https://github.com/eea/volto-eea-website-theme/commit/eeb049bb02146a48949b8ff5f5d09727e99fe192)
34
+
7
35
  #### [0.5.2](https://github.com/eea/volto-eea-website-theme/compare/0.5.1...0.5.2)
8
36
 
37
+ > 8 April 2022
38
+
39
+ - Release [`#22`](https://github.com/eea/volto-eea-website-theme/pull/22)
9
40
  - fix(banner): Friendly name for content-type if not available via RestAPI [`e9ea96f`](https://github.com/eea/volto-eea-website-theme/commit/e9ea96f3d74998e9d4e5ee9494183cdd40500666)
10
41
  - Small fix on replace all [`98fe72e`](https://github.com/eea/volto-eea-website-theme/commit/98fe72e4493aa322b704da1ddff91ee5021b66ce)
11
42
  - Make '@type' friendly in Page header [`9d15a78`](https://github.com/eea/volto-eea-website-theme/commit/9d15a78d445482ffe58b14839a2176b82c55bf71)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-website-theme",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
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",
@@ -53,19 +53,18 @@ export const TitleBlockEdit = (props) => {
53
53
  onFocusNextBlock,
54
54
  block,
55
55
  blockNode,
56
- properties,
57
- metadata,
58
56
  data,
59
57
  detached,
60
58
  editable,
61
59
  } = props;
60
+ const metadata = props.metadata || props.properties;
62
61
 
63
62
  const editor = useMemo(() => withReact(createEditor()), []);
64
63
  const intl = useIntl();
65
64
 
66
65
  const disableNewBlocks = data.disableNewBlocks || detached;
67
66
 
68
- const text = metadata?.['title'] || properties?.['title'] || '';
67
+ const text = metadata?.['title'] || '';
69
68
 
70
69
  const handleChange = useCallback(
71
70
  (value) => {
@@ -15,7 +15,7 @@ import BannerView from '@eeacms/volto-eea-website-theme/components/theme/Banner/
15
15
  * @extends Component
16
16
  */
17
17
  const View = (props) => {
18
- if (__SERVER__) return '';
18
+ if (__SERVER__) return <BannerView {...props} />;
19
19
  return (
20
20
  <Portal node={document.getElementById('page-header')}>
21
21
  <BannerView {...props} />
@@ -1,5 +1,5 @@
1
- const metadataSchema = {
2
- title: 'Metadata',
1
+ const infoSchema = {
2
+ title: 'Info',
3
3
  fieldsets: [
4
4
  {
5
5
  id: 'default',
@@ -27,7 +27,7 @@ export default {
27
27
  'hideCreationDate',
28
28
  'hidePublishingDate',
29
29
  'hideModificationDate',
30
- 'metadata',
30
+ 'info',
31
31
  ],
32
32
  },
33
33
  {
@@ -66,10 +66,10 @@ export default {
66
66
  title: 'Hide download button',
67
67
  type: 'boolean',
68
68
  },
69
- metadata: {
70
- title: 'Extra metadata',
69
+ info: {
70
+ title: 'Extra info',
71
71
  widget: 'object_list',
72
- schema: metadataSchema,
72
+ schema: infoSchema,
73
73
  },
74
74
  // contentType: {
75
75
  // title: 'Type',
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import { compose } from 'redux';
3
3
  import { connect } from 'react-redux';
4
- import moment from 'moment';
5
4
  import { Icon, Button, Grid } from 'semantic-ui-react';
5
+ import { formatDate } from '@plone/volto/helpers/Utils/Date';
6
6
  import config from '@plone/volto/registry';
7
7
 
8
8
  const socialPlatforms = {
@@ -16,6 +16,9 @@ const socialPlatforms = {
16
16
  shareLink: (url) =>
17
17
  `https://www.linkedin.com/sharing/share-offsite/?url=${url}`,
18
18
  },
19
+ reddit: {
20
+ shareLink: (url, title) => `https://reddit.com/submit?url=${url}`,
21
+ },
19
22
  };
20
23
 
21
24
  export const getImageSource = (image) => {
@@ -41,7 +44,7 @@ const Banner = ({ children }) => {
41
44
  Banner.Action = ({ title, icon, color, onClick, className }) => {
42
45
  return (
43
46
  <div className="action">
44
- <Button className={className} basic inverted onClick={onClick}>
47
+ <Button className={className} basic icon inverted onClick={onClick}>
45
48
  <Icon className={icon} color={color}></Icon>
46
49
  <span className="mobile hidden">{title}</span>
47
50
  </Button>
@@ -69,15 +72,21 @@ Banner.Title = ({ children }) => (
69
72
  );
70
73
  Banner.Metadata = ({ children }) => <p className="metadata">{children}</p>;
71
74
  Banner.MetadataField = ({ hidden, type = 'text', label, value, title }) => {
72
- moment.locale(config.settings.dateLocale || 'en-gb');
75
+ const locale = config.settings.dateLocale || 'en-gb';
73
76
  if (hidden || !value) return '';
74
77
  if (type === 'date' && value)
75
78
  return (
76
- <span
77
- className={`field ${type}`}
78
- title={title.replace('{}', value.format('lll'))}
79
- >
80
- {label} {value.format('ll')}
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
+ })}
81
90
  </span>
82
91
  );
83
92
  return <span className={`field ${type}`}>{value}</span>;
@@ -7,7 +7,6 @@ import { startCase } from 'lodash';
7
7
  import qs from 'querystring';
8
8
  import { Container, Popup } from 'semantic-ui-react';
9
9
  import { flattenToAppURL } from '@plone/volto/helpers';
10
- import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
11
10
  import Banner from './Banner';
12
11
  import { getImageSource, sharePage } from './Banner';
13
12
 
@@ -74,17 +73,10 @@ const Title = ({ config = {}, properties }) => {
74
73
  };
75
74
 
76
75
  const View = (props) => {
76
+ const { banner = {}, fluid, intl, location, types = [] } = props;
77
+ const metadata = props.metadata || props.properties;
77
78
  const {
78
- banner = {},
79
- properties,
80
- moment,
81
- fluid,
82
- intl,
83
- location,
84
- types = [],
85
- } = props;
86
- const {
87
- metadata = [],
79
+ info = [],
88
80
  hideContentType,
89
81
  hideCreationDate,
90
82
  hidePublishingDate,
@@ -101,11 +93,9 @@ const View = (props) => {
101
93
  // Set dates
102
94
  const getDate = useCallback(
103
95
  (hidden, key) => {
104
- return !hidden && properties[key]
105
- ? moment.default(properties[key])
106
- : null;
96
+ return !hidden && metadata[key] ? metadata[key] : null;
107
97
  },
108
- [moment, properties],
98
+ [metadata],
109
99
  );
110
100
  const creationDate = useMemo(() => getDate(hideCreationDate, 'created'), [
111
101
  getDate,
@@ -120,20 +110,20 @@ const View = (props) => {
120
110
  [getDate, hideModificationDate],
121
111
  );
122
112
  // Set image source
123
- const image = getImageSource(properties['image']);
113
+ const image = getImageSource(metadata['image']);
124
114
  // Get type
125
115
  const type = useMemo(() => {
126
116
  return (
127
117
  types.filter(
128
118
  (type) =>
129
119
  flattenToAppURL(type['@id']) ===
130
- `/@types/${properties['@type'] || parameters.type}`,
120
+ `/@types/${metadata['@type'] || parameters.type}`,
131
121
  )[0]?.title ||
132
- friendlyId(properties['@type']) ||
133
- properties['@type'] ||
122
+ friendlyId(metadata['@type']) ||
123
+ metadata['@type'] ||
134
124
  parameters.type
135
125
  );
136
- }, [types, properties, parameters]);
126
+ }, [types, metadata, parameters]);
137
127
 
138
128
  return (
139
129
  <Banner {...props}>
@@ -155,25 +145,30 @@ const View = (props) => {
155
145
  <div className="actions">
156
146
  <Banner.Action
157
147
  icon="ri-facebook-fill"
158
- color="blue"
159
148
  onClick={() => {
160
- sharePage(properties['@id'], 'facebook');
149
+ sharePage(metadata['@id'], 'facebook');
161
150
  }}
162
151
  />
163
152
  <Banner.Action
164
153
  icon="ri-twitter-fill"
165
- color="blue"
166
154
  onClick={() => {
167
- sharePage(properties['@id'], 'twitter');
155
+ sharePage(metadata['@id'], 'twitter');
168
156
  }}
169
157
  />
170
158
  <Banner.Action
171
159
  icon="ri-linkedin-fill"
172
- color="blue"
173
160
  onClick={() => {
174
- sharePage(properties['@id'], 'linkedin');
161
+ sharePage(metadata['@id'], 'linkedin');
162
+ }}
163
+ />
164
+ <Banner.Action icon="blogger b" />
165
+ <Banner.Action
166
+ icon="ri-reddit-line"
167
+ onClick={() => {
168
+ sharePage(metadata['@id'], 'reddit');
175
169
  }}
176
170
  />
171
+ <Banner.Action icon="stumbleupon circle" />
177
172
  </div>
178
173
  </>
179
174
  )}
@@ -202,7 +197,7 @@ const View = (props) => {
202
197
  </>
203
198
  }
204
199
  >
205
- <Title config={banner.title} properties={properties} />
200
+ <Title config={banner.title} properties={metadata} />
206
201
  <Banner.Metadata>
207
202
  <Banner.MetadataField
208
203
  type="type"
@@ -228,9 +223,9 @@ const View = (props) => {
228
223
  value={modificationDate}
229
224
  title={`${intl.formatMessage(messages.modified_on)} {}`}
230
225
  />
231
- {metadata.map((item, index) => (
226
+ {info.map((item, index) => (
232
227
  <Banner.MetadataField
233
- key={`header-metadata-${index}`}
228
+ key={`header-info-${index}`}
234
229
  value={item.description}
235
230
  />
236
231
  ))}
@@ -245,10 +240,10 @@ const View = (props) => {
245
240
 
246
241
  export default compose(
247
242
  injectIntl,
248
- injectLazyLibs(['moment']),
243
+ withRouter,
249
244
  connect((state) => {
250
245
  return {
251
246
  types: state.types.types,
252
247
  };
253
248
  }),
254
- )(withRouter(View));
249
+ )(View);
@@ -1,3 +1,3 @@
1
- body:not(.wf-state-published) {
1
+ body.view-viewview:not(.wf-state-published) {
2
2
  background-image: url('draft.png') !important;
3
3
  }