@eeacms/volto-hero-block 3.0.0 → 4.0.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,7 +4,32 @@ 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
- ### [3.0.0](https://github.com/eea/volto-hero-block/compare/2.1.0...3.0.0) - 22 December 2022
7
+ ### [4.0.0](https://github.com/eea/volto-hero-block/compare/3.0.1...4.0.0) - 7 February 2023
8
+
9
+ #### :nail_care: Enhancements
10
+
11
+ - change(theme): color_picker widget for themes #12 from eea/color_pick_themes [ichim-david - [`d3e0e92`](https://github.com/eea/volto-hero-block/commit/d3e0e9266795b09d465cc00bff752040c8274bd8)]
12
+
13
+ #### :hammer_and_wrench: Others
14
+
15
+ - Release 4.0.0 [Alin Voinea - [`4f211df`](https://github.com/eea/volto-hero-block/commit/4f211df1c6488d1d70f009b592b828575ee783d6)]
16
+ - lint fix [David Ichim - [`1a51209`](https://github.com/eea/volto-hero-block/commit/1a51209dbaec1b9aa1a7e16f3d997dcf5fa8f764)]
17
+ - more theme_picker [Andrei Grigore - [`801ead1`](https://github.com/eea/volto-hero-block/commit/801ead1355eeb4a4fea371b84b91db3e651d7a40)]
18
+ - add theme_picker widget [Andrei Grigore - [`aef11f7`](https://github.com/eea/volto-hero-block/commit/aef11f7c26c3e2ec5d997ede076062bf9d23237c)]
19
+ - color_picker widget for themes [andreiggr - [`4037c24`](https://github.com/eea/volto-hero-block/commit/4037c24b850b5f514a2bafba156fd7888678cea5)]
20
+ ### [3.0.1](https://github.com/eea/volto-hero-block/compare/3.0.0...3.0.1) - 27 January 2023
21
+
22
+ #### :rocket: New Features
23
+
24
+ - feat(hero): added background position styling option [David Ichim - [`8d933f6`](https://github.com/eea/volto-hero-block/commit/8d933f6e03a495b055d81923a37b0affd769c770)]
25
+
26
+ #### :nail_care: Enhancements
27
+
28
+ - change(hero): bg class setting to ensure it's set on the hero-image section [David Ichim - [`ce0305f`](https://github.com/eea/volto-hero-block/commit/ce0305feed18e6ca5f22ee7786db93283944484a)]
29
+
30
+ #### :hammer_and_wrench: Others
31
+
32
+ ## [3.0.0](https://github.com/eea/volto-hero-block/compare/2.1.0...3.0.0) - 22 December 2022
8
33
 
9
34
  #### :rocket: New Features
10
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-hero-block",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "@eeacms/volto-hero-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -20,7 +20,8 @@
20
20
  "@eeacms/volto-object-widget"
21
21
  ],
22
22
  "dependencies": {
23
- "@eeacms/volto-object-widget": "*"
23
+ "@eeacms/volto-object-widget": "*",
24
+ "@eeacms/volto-widget-theme-picker": "^1.0.1"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@cypress/code-coverage": "^3.10.0",
@@ -58,7 +58,7 @@ function Hero({
58
58
  )}
59
59
  >
60
60
  <div
61
- className={cx('hero-block-image')}
61
+ className={cx('hero-block-image', styles?.bg)}
62
62
  style={
63
63
  image
64
64
  ? {
@@ -1,4 +1,15 @@
1
1
  import { addStyling } from '@plone/volto/helpers';
2
+ import config from '@plone/volto/registry';
3
+
4
+ import alignTopSVG from '@plone/volto/icons/move-up.svg';
5
+ import alignCenterSVG from '@plone/volto/icons/row.svg';
6
+ import alignBottomSVG from '@plone/volto/icons/move-down.svg';
7
+
8
+ const ALIGN_INFO_MAP = {
9
+ 'has--bg--top': [alignTopSVG, 'Top'],
10
+ 'has--bg--center': [alignCenterSVG, 'Center'],
11
+ 'has--bg--bottom': [alignBottomSVG, 'Bottom'],
12
+ };
2
13
 
3
14
  export default () => {
4
15
  return {
@@ -97,6 +108,7 @@ export const stylingSchema = (props) => {
97
108
  title: 'Default',
98
109
  fields: [
99
110
  'backgroundVariant',
111
+ 'bg',
100
112
  'alignContent',
101
113
  'textAlign',
102
114
  'textVariant',
@@ -106,13 +118,24 @@ export const stylingSchema = (props) => {
106
118
  },
107
119
  ],
108
120
  properties: {
121
+ bg: {
122
+ title: 'Background image position',
123
+ widget: 'align',
124
+ actions: Object.keys(ALIGN_INFO_MAP),
125
+ actionsInfoMap: ALIGN_INFO_MAP,
126
+ defaultValue: 'has--bg--center',
127
+ },
109
128
  backgroundVariant: {
110
129
  title: 'Background theme',
111
- choices: [
112
- ['primary', 'Primary'],
113
- ['secondary', 'Secondary'],
114
- ['tertiary', 'Tertiary'],
115
- ['grey', 'Grey'],
130
+ widget: 'theme_picker',
131
+ colors: [
132
+ ...(config.settings && config.settings.themeColors
133
+ ? config.settings.themeColors.map(({ value, title }) => ({
134
+ name: value,
135
+ label: title,
136
+ }))
137
+ : []),
138
+ //and add extra ones here
116
139
  ],
117
140
  },
118
141
  alignContent: {
@@ -131,18 +154,28 @@ export const stylingSchema = (props) => {
131
154
  },
132
155
  textVariant: {
133
156
  title: 'Text theme',
134
- choices: [
135
- ['primary', 'Primary'],
136
- ['secondary', 'Secondary'],
137
- ['tertiary', 'Tertiary'],
157
+ widget: 'theme_picker',
158
+ colors: [
159
+ ...(config.settings && config.settings.themeColors
160
+ ? config.settings.themeColors.map(({ value, title }) => ({
161
+ name: value,
162
+ label: title,
163
+ }))
164
+ : []),
165
+ //and add extra ones here
138
166
  ],
139
167
  },
140
168
  buttonVariant: {
141
169
  title: 'Button theme',
142
- choices: [
143
- ['primary', 'Primary'],
144
- ['secondary', 'Secondary'],
145
- ['tertiary', 'Tertiary'],
170
+ widget: 'theme_picker',
171
+ colors: [
172
+ ...(config.settings && config.settings.themeColors
173
+ ? config.settings.themeColors.map(({ value, title }) => ({
174
+ name: value,
175
+ label: title,
176
+ }))
177
+ : []),
178
+ //and add extra ones here
146
179
  ],
147
180
  },
148
181
  buttonAlign: {