@eeacms/volto-eea-design-system 1.0.0-alpha.10 → 1.0.0-alpha.11

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,7 +4,38 @@ 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.0-alpha.10](https://github.com/eea/volto-eea-design-system/compare/1.0.0-alpha.9...1.0.0-alpha.10) - 12 January 2023
7
+ ### [1.0.0-alpha.11](https://github.com/eea/volto-eea-design-system/compare/1.0.0-alpha.10...1.0.0-alpha.11) - 17 January 2023
8
+
9
+ #### :rocket: New Features
10
+
11
+ - feat(docusaurus): Header and footer elements section #277 [ichim-david - [`0df271c`](https://github.com/eea/volto-eea-design-system/commit/0df271c4c79bd8a24750cfe44d69f32cb04a1b63)]
12
+
13
+ #### :bug: Bug Fixes
14
+
15
+ - fix(banner): storybook date input and simplified gradient opacity [David Ichim - [`7674d76`](https://github.com/eea/volto-eea-design-system/commit/7674d767bb770342828d6bea6953ce45b823943f)]
16
+ - fix(banner): re-added title class on banner title [David Ichim - [`6d15799`](https://github.com/eea/volto-eea-design-system/commit/6d157994934c3da9af4e3dd37844f910bddf8377)]
17
+
18
+ #### :nail_care: Enhancements
19
+
20
+ - refactor(banner): sync storybook and Volto component #275 from eea/sync-page-banner-theme [ichim-david - [`4331fb4`](https://github.com/eea/volto-eea-design-system/commit/4331fb4a6d5744e7d7d6a001bca91265a22587fd)]
21
+ - change(banner): removed margin from title [David Ichim - [`17e592c`](https://github.com/eea/volto-eea-design-system/commit/17e592c4f3fd16a78069af50574e2ac608166a0f)]
22
+ - refactor(banner): sync storybook and Volto component [nileshgulia1 - [`c9087cc`](https://github.com/eea/volto-eea-design-system/commit/c9087cc8edc3fb27e0b96b509354861ec306f22a)]
23
+
24
+ #### :house: Documentation changes
25
+
26
+ - docs(footer): updates on header elements [Dora Anastasiou - [`b41c550`](https://github.com/eea/volto-eea-design-system/commit/b41c550475dc5a2eefcad5d75439601d079613e2)]
27
+ - docs(footer): add elements anatomy [Dora Anastasiou - [`d9f0872`](https://github.com/eea/volto-eea-design-system/commit/d9f0872f93a6f7572f798b2c001d3af00eb282e3)]
28
+
29
+ #### :hammer_and_wrench: Others
30
+
31
+ - Release 1.0.0-alpha.11 [Alin Voinea - [`07e8f85`](https://github.com/eea/volto-eea-design-system/commit/07e8f858b0bdeaa6a348c0bfc2b785f26017e1ea)]
32
+ - renamed image elements as requested in review [David Ichim - [`8541fb6`](https://github.com/eea/volto-eea-design-system/commit/8541fb6739d3c935ed8d44a220114546b2aef682)]
33
+ - update(gradient): use 8deg angle [nileshgulia1 - [`6fd597d`](https://github.com/eea/volto-eea-design-system/commit/6fd597d8d7a83fdf8a27939e4c69dfc3975b6a81)]
34
+ - update(gradiant): make it 0deg [nileshgulia1 - [`1bb2696`](https://github.com/eea/volto-eea-design-system/commit/1bb2696375eef233b509e27d9d464b8343421430)]
35
+ - remove(banner-gradiant): image gradiant in favour of text [nileshgulia1 - [`1b58520`](https://github.com/eea/volto-eea-design-system/commit/1b58520490be5e17ea4ce6fc98329d467dad3960)]
36
+ - remove(comment) referencing old verison of title [nileshgulia1 - [`4226d42`](https://github.com/eea/volto-eea-design-system/commit/4226d42e34b119e057cf4e9878b6a99172cb976a)]
37
+ - add(banner): banner title css [nileshgulia1 - [`d003247`](https://github.com/eea/volto-eea-design-system/commit/d0032474d2b57eb63a4b50a882ced2ee743a48e6)]
38
+ ### [1.0.0-alpha.10](https://github.com/eea/volto-eea-design-system/compare/1.0.0-alpha.9...1.0.0-alpha.10) - 13 January 2023
8
39
 
9
40
  #### :bug: Bug Fixes
10
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-eea-design-system",
3
- "version": "1.0.0-alpha.10",
3
+ "version": "1.0.0-alpha.11",
4
4
  "description": "@eeacms/volto-eea-design-system: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -1,22 +1,68 @@
1
1
  import React from 'react';
2
2
  import { Container, Icon, Button, Grid } from 'semantic-ui-react';
3
3
  import PropTypes from 'prop-types';
4
+ import { formatDate } from '@plone/volto/helpers/Utils/Date';
5
+ import config from '@plone/volto/registry';
4
6
 
5
7
  Banner.propTypes = {
6
8
  title: PropTypes.string,
7
9
  image: PropTypes.bool,
8
10
  };
9
11
 
10
- function Banner({ image_url, image, children }) {
12
+ const socialPlatforms = {
13
+ facebook: {
14
+ shareLink: (url) => `https://facebook.com/sharer.php?u=${url}`,
15
+ },
16
+ twitter: {
17
+ shareLink: (url) => `https://www.twitter.com/share?url=${url}`,
18
+ },
19
+ linkedin: {
20
+ shareLink: (url) =>
21
+ `https://www.linkedin.com/sharing/share-offsite/?url=${url}`,
22
+ },
23
+ reddit: {
24
+ shareLink: (url, title) => `https://reddit.com/submit?url=${url}`,
25
+ },
26
+ };
27
+
28
+ export const getImageSource = (image) => {
29
+ if (image?.download) return image.download;
30
+ if (image?.encoding)
31
+ return `data:${image['content-type']};${image['encoding']},${image['data']}`;
32
+ return null;
33
+ };
34
+
35
+ export const sharePage = (url, platform) => {
36
+ if (!socialPlatforms[platform]) return;
37
+ const link = document.createElement('a');
38
+ link.setAttribute('href', socialPlatforms[platform].shareLink(url));
39
+ link.setAttribute('target', '_blank');
40
+ link.setAttribute('rel', 'noreferrer');
41
+ link.click();
42
+ };
43
+
44
+ function Banner({ image, metadata, properties, children, ...rest }) {
45
+ if (image) {
46
+ //extract Lead image from page content.
47
+ const content = metadata || properties;
48
+ const imageUrl = getImageSource(content['image']) ?? image;
49
+ return (
50
+ <div className="eea banner">
51
+ <div
52
+ className={imageUrl ? 'image' : ''}
53
+ style={imageUrl ? { backgroundImage: `url(${imageUrl})` } : {}}
54
+ >
55
+ <div className="gradient">
56
+ <Container>{children}</Container>
57
+ </div>
58
+ </div>
59
+ </div>
60
+ );
61
+ }
11
62
  return (
12
63
  <div className="eea banner">
13
- <div
14
- className={image ? 'image' : ''}
15
- style={image ? { backgroundImage: `url(${image_url})` } : {}}
16
- >
17
- <div className="gradient">
18
- <Container>{children}</Container>
19
- </div>
64
+ <div className="gradient">
65
+ <Container>{children}</Container>
20
66
  </div>
21
67
  </div>
22
68
  );
@@ -48,18 +94,31 @@ Banner.Content = ({ children, actions }) => {
48
94
  );
49
95
  };
50
96
 
51
- Banner.Title = ({ children }) => <p className="title">{children}</p>;
97
+ Banner.Title = ({ children }) => {
98
+ return <h1 className="documentFirstHeading title">{children}</h1>;
99
+ };
52
100
  Banner.Subtitle = ({ children }) => <p className="subtitle">{children}</p>;
53
101
  Banner.Metadata = ({ children }) => <p className="metadata">{children}</p>;
54
102
 
55
103
  Banner.MetadataField = ({ hidden, type = 'text', label, value, title }) => {
104
+ const locale = config.settings.dateLocale || 'en-gb';
56
105
  if (hidden || !value) return '';
57
- return (
58
- <span className={`field ${type}`}>
59
- {label && <>{label}: </>}
60
- {value}
61
- </span>
62
- );
106
+ if (type === 'date' && value)
107
+ return (
108
+ <span className={`field ${type}`} title={title?.replace('{}', value)}>
109
+ {label}{' '}
110
+ {formatDate({
111
+ date: value,
112
+ format: {
113
+ year: 'numeric',
114
+ month: 'short',
115
+ day: '2-digit',
116
+ },
117
+ locale: locale,
118
+ })}
119
+ </span>
120
+ );
121
+ return <span className={`field ${type}`}>{value}</span>;
63
122
  };
64
123
 
65
124
  export default Banner;
@@ -74,7 +74,7 @@ export default {
74
74
  };
75
75
 
76
76
  const Template = (args) => (
77
- <Banner {...args} image_url={args.image ? imgUrl : null}>
77
+ <Banner {...args} image={args.image ? imgUrl : null}>
78
78
  <Banner.Content
79
79
  actions={
80
80
  <>
@@ -143,8 +143,8 @@ Default.args = {
143
143
  subtitle: 'Lorem ipsum dolor',
144
144
  metadata: [
145
145
  { hidden: false, value: 'Briefing', type: 'type' },
146
- { hidden: false, value: 'Published Date', type: 'date' },
147
- { hidden: false, value: 'Modified Date', type: 'date' },
146
+ { hidden: false, label: 'Published', value: '25 Nov 2022', type: 'date' },
147
+ { hidden: false, label: 'Modified', value: '29 Nov 2022', type: 'date' },
148
148
  { hidden: false, value: '5 min read', type: '' },
149
149
  ],
150
150
  image: true,
@@ -91,13 +91,20 @@
91
91
  background-size: @imageBackgroundSize;
92
92
 
93
93
  .gradient {
94
- background-image: @backgroundGradientWithImage;
95
-
96
94
  .content {
97
95
  padding: @mobileContentPaddingWithImage;
98
96
  }
99
97
  }
100
98
  }
99
+
100
+ .documentFirstHeading {
101
+ border-bottom: @titleBorderBottom;
102
+ margin-bottom: @titleMarginBottom;
103
+
104
+ &::before {
105
+ content: @titleBorderBottom;
106
+ }
107
+ }
101
108
  }
102
109
 
103
110
  /*Share Popup*/
@@ -218,4 +225,3 @@
218
225
  }
219
226
 
220
227
  .loadUIOverrides();
221
-
@@ -10,8 +10,7 @@
10
10
  @imageBackgroundPosition : center;
11
11
 
12
12
  /* Gradient */
13
- @backgroundGradient : linear-gradient(8deg, #0c1b28b3 32%, rgba(0, 36, 78, 0) 80%);
14
- @backgroundGradientWithImage : linear-gradient(0deg, rgb(20, 33, 44, 90%) 24%, rgba(0, 36, 78, 0) 80%);
13
+ @backgroundGradient : linear-gradient(8deg,rgba(12,27,40, 0.7) 32%,rgba(0,36,78,0) 80%);
15
14
  @backgroundGradientOpacity : 1;
16
15
 
17
16
  /* Content */
@@ -26,15 +25,18 @@
26
25
  /* Title */
27
26
  @titleFontWeight : @bold;
28
27
  @titleMaxWidth : 100%;
29
- @mobileTitleFontSize : 1.25rem;
30
- @tabletTitleFontSize : 2.25rem;
31
- @computerTitleFontSize : 3rem;
32
- @mobileTitleLineHeight : 1.375rem;
33
- @tabletTitleLineHeight : 2.75rem;
34
- @computerTitleLineHeight : 3.5rem;
35
- @mobileTitleMargin : 0 0 0.5rem 0;
36
- @tabletTitleMargin : 0 0 0.813rem 0;
37
- @computerTitleMargin : 0 0 1.125rem 0;
28
+ @titleMarginBottom : 0;
29
+ @titleBorderBottom : none;
30
+ @mobileTitleFontSize : @mobileH1;
31
+ @tabletTitleFontSize : @h2;
32
+ @computerTitleFontSize : @h1;
33
+ @mobileTitleLineHeight : @headerLineHeight;
34
+ @tabletTitleLineHeight : @headerLineHeight;
35
+ @computerTitleLineHeight : @headerLineHeight;
36
+ @mobileTitleMargin : 0 0 0 0;
37
+ @tabletTitleMargin : 0 0 0 0;
38
+ @computerTitleMargin : 0 0 0 0;
39
+
38
40
 
39
41
  /* Subtitle */
40
42
  @subtitleFontWeight : @bold;
@@ -85,4 +87,4 @@
85
87
  @sharePopupLineHeight: 1rem;
86
88
  // Actions
87
89
  @sharePopupActionsIconColor: @pineGreen;
88
- @sharePopupActionsIconMargin: 0;
90
+ @sharePopupActionsIconMargin: 0;