@eeacms/volto-hero-block 1.0.0 → 2.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.
@@ -1,7 +1,9 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
 
4
- const projectRootPath = fs.realpathSync('./project'); // __dirname
4
+ const projectRootPath = fs.existsSync('./project')
5
+ ? fs.realpathSync('./project')
6
+ : fs.realpathSync('./../../../');
5
7
  const packageJson = require(path.join(projectRootPath, 'package.json'));
6
8
  const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;
7
9
 
package/CHANGELOG.md CHANGED
@@ -4,7 +4,20 @@ 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](https://github.com/eea/volto-hero-block/compare/0.2.0...1.0.0) - 28 October 2022
7
+ ### [2.0.0](https://github.com/eea/volto-hero-block/compare/1.0.0...2.0.0) - 15 November 2022
8
+
9
+ #### :nail_care: Enhancements
10
+
11
+ - refactor(Styling): Use schemaEnhancer in favor of StyleWrapper [Alin Voinea - [`dacf4db`](https://github.com/eea/volto-hero-block/commit/dacf4db6c59a584639f13c7ce8a3d7bd808ea64c)]
12
+
13
+ #### :house: Internal changes
14
+
15
+ - style(volto-hero-block): set correctly the background color [Miu Razvan - [`9358a17`](https://github.com/eea/volto-hero-block/commit/9358a1777c25664cbfe9c66a6c9054521a11ff24)]
16
+
17
+ #### :hammer_and_wrench: Others
18
+
19
+ - test(estlint): Fix .project.eslintrc.js [Alin Voinea - [`b8f0971`](https://github.com/eea/volto-hero-block/commit/b8f0971b21a5334d40c1b8f5103cea61d9ffe6f1)]
20
+ ## [1.0.0](https://github.com/eea/volto-hero-block/compare/0.2.0...1.0.0) - 28 October 2022
8
21
 
9
22
  #### :nail_care: Enhancements
10
23
 
package/README.md CHANGED
@@ -21,6 +21,12 @@ Enhanced Hero Block [Volto](https://github.com/plone/volto) add-on
21
21
 
22
22
  Demo GIF
23
23
 
24
+ ## Upgrade
25
+
26
+ ### Upgrading to 2.x
27
+
28
+ This version requires: `@plone/volto >= 16.0.0.alpha.46` (schemaEnhancer / addStyling).
29
+
24
30
  ## Getting started
25
31
 
26
32
  ### Add volto-hero-block to your Volto project
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-hero-block",
3
- "version": "1.0.0",
3
+ "version": "2.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",
@@ -46,5 +46,5 @@
46
46
  "i18n": "make i18n",
47
47
  "cypress:run": "make cypress-run",
48
48
  "cypress:open": "make cypress-open"
49
- }
49
+ }
50
50
  }
@@ -33,18 +33,28 @@ function Hero({
33
33
  <div
34
34
  className={cx(
35
35
  'eea hero-block',
36
- { spaced },
37
- { inverted },
38
- !image && backgroundVariant && `color-bg-${backgroundVariant}`,
36
+ !image &&
37
+ backgroundVariant &&
38
+ !fullWidth &&
39
+ `color-bg-${backgroundVariant}`,
39
40
  {
41
+ spaced,
42
+ inverted,
40
43
  'full-height': fullHeight,
41
44
  },
42
45
  )}
43
46
  >
44
47
  <div
45
- className={cx('hero-block-image-wrapper', {
46
- 'full-width': fullWidth,
47
- })}
48
+ className={cx(
49
+ 'hero-block-image-wrapper',
50
+ !image &&
51
+ backgroundVariant &&
52
+ fullWidth &&
53
+ `color-bg-${backgroundVariant}`,
54
+ {
55
+ 'full-width': fullWidth,
56
+ },
57
+ )}
48
58
  >
49
59
  <div
50
60
  className={cx('hero-block-image')}
@@ -12,8 +12,7 @@ export default (config) => {
12
12
  edit: HeroEdit,
13
13
  view: HeroView,
14
14
  blockHasOwnFocusManagement: true,
15
- stylesSchema: stylingSchema,
16
- enableStyling: true,
15
+ schemaEnhancer: stylingSchema,
17
16
  restricted: false,
18
17
  mostUsed: false,
19
18
  sidebarTab: 1,
@@ -1,4 +1,6 @@
1
- export default ({ data }) => {
1
+ import { addStyling } from '@plone/volto/helpers';
2
+
3
+ export default () => {
2
4
  return {
3
5
  title: 'Hero',
4
6
  fieldsets: [
@@ -66,69 +68,73 @@ export default ({ data }) => {
66
68
  };
67
69
  };
68
70
 
69
- export const stylingSchema = ({ intl }) => ({
70
- title: 'Hero style',
71
- block: 'hero',
72
- fieldsets: [
73
- {
74
- id: 'default',
75
- title: 'Default',
76
- fields: [
77
- 'backgroundVariant',
78
- 'alignContent',
79
- 'textAlign',
80
- 'textVariant',
81
- 'buttonVariant',
82
- 'buttonAlign',
83
- ],
84
- },
85
- ],
86
- properties: {
87
- backgroundVariant: {
88
- title: 'Background theme',
89
- choices: [
90
- ['primary', 'Primary'],
91
- ['secondary', 'Secondary'],
92
- ['tertiary', 'Tertiary'],
93
- ['grey', 'Grey'],
94
- ],
95
- },
96
- alignContent: {
97
- title: 'Content align',
98
- choices: [
99
- ['start', 'Top'],
100
- ['center', 'Center'],
101
- ['end', 'Bottom'],
102
- ],
103
- },
104
- textAlign: {
105
- title: 'Text align',
106
- widget: 'align',
107
- actions: ['left', 'center', 'right'],
108
- defaultValue: 'left',
109
- },
110
- textVariant: {
111
- title: 'Text theme',
112
- choices: [
113
- ['primary', 'Primary'],
114
- ['secondary', 'Secondary'],
115
- ['tertiary', 'Tertiary'],
116
- ],
117
- },
118
- buttonVariant: {
119
- title: 'Button theme',
120
- choices: [
121
- ['primary', 'Primary'],
122
- ['secondary', 'Secondary'],
123
- ['tertiary', 'Tertiary'],
124
- ],
125
- },
126
- buttonAlign: {
127
- title: 'Button align',
128
- widget: 'align',
129
- actions: ['left', 'center', 'right'],
130
- defaultValue: 'left',
71
+ export const stylingSchema = (props) => {
72
+ const schema = addStyling(props);
73
+ schema.properties.styles.schema = {
74
+ title: 'Hero style',
75
+ block: 'hero',
76
+ fieldsets: [
77
+ {
78
+ id: 'default',
79
+ title: 'Default',
80
+ fields: [
81
+ 'backgroundVariant',
82
+ 'alignContent',
83
+ 'textAlign',
84
+ 'textVariant',
85
+ 'buttonVariant',
86
+ 'buttonAlign',
87
+ ],
88
+ },
89
+ ],
90
+ properties: {
91
+ backgroundVariant: {
92
+ title: 'Background theme',
93
+ choices: [
94
+ ['primary', 'Primary'],
95
+ ['secondary', 'Secondary'],
96
+ ['tertiary', 'Tertiary'],
97
+ ['grey', 'Grey'],
98
+ ],
99
+ },
100
+ alignContent: {
101
+ title: 'Content align',
102
+ choices: [
103
+ ['start', 'Top'],
104
+ ['center', 'Center'],
105
+ ['end', 'Bottom'],
106
+ ],
107
+ },
108
+ textAlign: {
109
+ title: 'Text align',
110
+ widget: 'align',
111
+ actions: ['left', 'center', 'right'],
112
+ defaultValue: 'left',
113
+ },
114
+ textVariant: {
115
+ title: 'Text theme',
116
+ choices: [
117
+ ['primary', 'Primary'],
118
+ ['secondary', 'Secondary'],
119
+ ['tertiary', 'Tertiary'],
120
+ ],
121
+ },
122
+ buttonVariant: {
123
+ title: 'Button theme',
124
+ choices: [
125
+ ['primary', 'Primary'],
126
+ ['secondary', 'Secondary'],
127
+ ['tertiary', 'Tertiary'],
128
+ ],
129
+ },
130
+ buttonAlign: {
131
+ title: 'Button align',
132
+ widget: 'align',
133
+ actions: ['left', 'center', 'right'],
134
+ defaultValue: 'left',
135
+ },
131
136
  },
132
- },
133
- required: [],
134
- });
137
+ required: [],
138
+ };
139
+ return schema;
140
+ };