Skip to content

Commit 0417a27

Browse files
bfintalgumacahin
andauthored
fix (variation picker): attributes not present in free version (#2178)
* fix (variation picker): attributes not present in free version * Add `attribute` property to each variations for blocks that have variations. The `attribute` property defines a `className` property that is the variation name prefixed with 'is-style-'. This determines if a variation is active. * className typo * Add missing attribue property to variations. * Update float variation className. * Correct className for interted-vertical variation of testimonial block. * Remove extraneous whitespace. Co-authored-by: Marco Enrico <[email protected]>
1 parent 3508ecf commit 0417a27

File tree

14 files changed

+168
-3
lines changed

14 files changed

+168
-3
lines changed

src/block/accordion/variations.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ const variations = applyFilters(
112112
{
113113
name: 'shadow',
114114
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Shadow', i18n ) ),
115+
attributes: {
116+
className: 'is-style-shadow',
117+
},
115118
isActive: [ 'className' ],
116119
pickerTitle: __( 'Shadow', i18n ),
117120
pickerIcon: ImageShadow,
@@ -121,6 +124,9 @@ const variations = applyFilters(
121124
{
122125
name: 'colored',
123126
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Colored', i18n ) ),
127+
attributes: {
128+
className: 'is-style-colored',
129+
},
124130
isActive: [ 'className' ],
125131
pickerTitle: __( 'Colored', i18n ),
126132
pickerIcon: ImageColored,
@@ -130,6 +136,9 @@ const variations = applyFilters(
130136
{
131137
name: 'plus',
132138
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Plus', i18n ) ),
139+
attributes: {
140+
className: 'is-style-plus',
141+
},
133142
isActive: [ 'className' ],
134143
pickerTitle: __( 'Plus', i18n ),
135144
pickerIcon: ImagePlus,

src/block/blockquote/variations.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ const variations = applyFilters(
8080
{
8181
name: 'highlighted',
8282
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Highlighted', i18n ) ),
83+
attributes: {
84+
className: 'is-style-highlighted',
85+
},
8386
isActive: [ 'className' ],
8487
pickerTitle: __( 'Highlighted', i18n ),
8588
pickerIcon: ImageHighlighted,
@@ -89,6 +92,9 @@ const variations = applyFilters(
8992
{
9093
name: 'huge',
9194
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Huge', i18n ) ),
95+
attributes: {
96+
className: 'is-style-huge',
97+
},
9298
isActive: [ 'className' ],
9399
pickerTitle: __( 'Huge', i18n ),
94100
pickerIcon: ImageHuge,
@@ -98,6 +104,9 @@ const variations = applyFilters(
98104
{
99105
name: 'centered-quote',
100106
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Centered Quote', i18n ) ),
107+
attributes: {
108+
className: 'is-style-centered-quote',
109+
},
101110
isActive: [ 'className' ],
102111
pickerTitle: __( 'Centered Quote', i18n ),
103112
pickerIcon: ImageCenteredQuote,

src/block/call-to-action/variations.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ const variations = applyFilters(
7474
{
7575
name: 'horizontal-2',
7676
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Horizontal 2', i18n ) ),
77+
attributes: {
78+
className: 'is-style-horizontal-2',
79+
},
7780
isActive: [ 'className' ],
7881
pickerTitle: __( 'Horizontal 2', i18n ),
7982
pickerIcon: ImageHorizontal2,
@@ -83,6 +86,9 @@ const variations = applyFilters(
8386
{
8487
name: 'horizontal-3',
8588
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Horizontal 3', i18n ) ),
89+
attributes: {
90+
className: 'is-style-horizontal-3',
91+
},
8692
isActive: [ 'className' ],
8793
pickerTitle: __( 'Horizontal 3', i18n ),
8894
pickerIcon: ImageHorizontal3,
@@ -92,6 +98,9 @@ const variations = applyFilters(
9298
{
9399
name: 'split-centered',
94100
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Split Centered', i18n ) ),
101+
attributes: {
102+
className: 'is-style-split-centered',
103+
},
95104
isActive: [ 'className' ],
96105
pickerTitle: __( 'Split Centered', i18n ),
97106
pickerIcon: ImageSplitCentered,

src/block/card/variations.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ const variations = applyFilters(
122122
{
123123
name: 'horizontal',
124124
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Horizontal', i18n ) ),
125+
attributes: {
126+
className: 'is-style-horizontal',
127+
},
125128
pickerTitle: __( 'Horizontal', i18n ),
126129
pickerIcon: ImageHorizontal,
127130
isActive: [ 'className' ],
@@ -131,6 +134,9 @@ const variations = applyFilters(
131134
{
132135
name: 'full',
133136
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Full', i18n ) ),
137+
attributes: {
138+
className: 'is-style-full',
139+
},
134140
pickerTitle: __( 'Full', i18n ),
135141
pickerIcon: ImageFull,
136142
isActive: [ 'className' ],
@@ -140,6 +146,9 @@ const variations = applyFilters(
140146
{
141147
name: 'faded',
142148
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Faded', i18n ) ),
149+
attributes: {
150+
className: 'is-style-faded',
151+
},
143152
pickerTitle: __( 'Faded', i18n ),
144153
pickerIcon: ImageFaded,
145154
isActive: [ 'className' ],

src/block/feature-grid/variations.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const variations = applyFilters(
9292
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Float', i18n ) ),
9393
attributes: {
9494
innerBlockContentAlign: 'alignwide',
95-
className: 'is-style-horizontal',
95+
className: 'is-style-float',
9696
align: 'full',
9797
},
9898
isActive: [ 'className' ],
@@ -165,6 +165,9 @@ const variations = applyFilters(
165165
{
166166
name: 'horizontal',
167167
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Horizontal', i18n ) ),
168+
attributes: {
169+
className: 'is-style-horizontal',
170+
},
168171
isActive: [ 'className' ],
169172
pickerTitle: __( 'Horizontal', i18n ),
170173
pickerIcon: ImageHorizontal,
@@ -174,6 +177,9 @@ const variations = applyFilters(
174177
{
175178
name: 'large-mid',
176179
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Large Mid', i18n ) ),
180+
attributes: {
181+
className: 'is-style-large-mid',
182+
},
177183
isActive: [ 'className' ],
178184
pickerTitle: __( 'Large Mid', i18n ),
179185
pickerIcon: ImageLargeMid,
@@ -183,6 +189,9 @@ const variations = applyFilters(
183189
{
184190
name: 'offset',
185191
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Offset', i18n ) ),
192+
attributes: {
193+
className: 'is-style-offset',
194+
},
186195
isActive: [ 'className' ],
187196
pickerTitle: __( 'Offset', i18n ),
188197
pickerIcon: ImageOffset,
@@ -192,6 +201,9 @@ const variations = applyFilters(
192201
{
193202
name: 'zigzag',
194203
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Zizag', i18n ) ),
204+
attributes: {
205+
className: 'is-style-zigzag',
206+
},
195207
isActive: [ 'className' ],
196208
pickerTitle: __( 'Zigzag', i18n ),
197209
pickerIcon: ImageZigZag,

src/block/feature/variations.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ const variations = applyFilters(
9494
{
9595
name: 'overlap-shape-1',
9696
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Overlap Shape 1', i18n ) ),
97+
attributes: {
98+
className: 'is-style-overlap-shape-1',
99+
},
97100
isActive: [ 'className' ],
98101
pickerTitle: __( 'Overlap Shape 1', i18n ),
99102
pickerIcon: ImageOverlapShape1,
@@ -103,6 +106,9 @@ const variations = applyFilters(
103106
{
104107
name: 'overlap-shape-2',
105108
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Overlap Shape 2', i18n ) ),
109+
attributes: {
110+
className: 'is-style-overlap-shape-2',
111+
},
106112
isActive: [ 'className' ],
107113
pickerTitle: __( 'Overlap Shape 2', i18n ),
108114
pickerIcon: ImageOverlapShape2,
@@ -112,6 +118,9 @@ const variations = applyFilters(
112118
{
113119
name: 'overlap-shape-3',
114120
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Overlap Shape 3', i18n ) ),
121+
attributes: {
122+
className: 'is-style-overlap-shape-3',
123+
},
115124
isActive: [ 'className' ],
116125
pickerTitle: __( 'Overlap Shape 3', i18n ),
117126
pickerIcon: ImageOverlapShape3,
@@ -121,6 +130,9 @@ const variations = applyFilters(
121130
{
122131
name: 'overlap-shape-4',
123132
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Overlap Shape 4', i18n ) ),
133+
attributes: {
134+
className: 'is-style-overlap-shape-4',
135+
},
124136
isActive: [ 'className' ],
125137
pickerTitle: __( 'Overlap Shape 4', i18n ),
126138
pickerIcon: ImageOverlapShape4,
@@ -130,6 +142,9 @@ const variations = applyFilters(
130142
{
131143
name: 'overlap-shape-5',
132144
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Overlap Shape 5', i18n ) ),
145+
attributes: {
146+
className: 'is-style-overlap-shape-5',
147+
},
133148
isActive: [ 'className' ],
134149
pickerTitle: __( 'Overlap Shape 5', i18n ),
135150
pickerIcon: ImageOverlapShape5,
@@ -139,6 +154,9 @@ const variations = applyFilters(
139154
{
140155
name: 'overlap-background-1',
141156
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Overlap Background 1', i18n ) ),
157+
attributes: {
158+
className: 'is-style-overlap-background-1',
159+
},
142160
isActive: [ 'className' ],
143161
pickerTitle: __( 'Overlap Background 1', i18n ),
144162
pickerIcon: ImageOverlapBg1,
@@ -148,6 +166,9 @@ const variations = applyFilters(
148166
{
149167
name: 'overlap-background-2',
150168
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Overlap Background 2', i18n ) ),
169+
attributes: {
170+
className: 'is-style-overlap-background-2',
171+
},
151172
isActive: [ 'className' ],
152173
pickerTitle: __( 'Overlap Background 2', i18n ),
153174
pickerIcon: ImageOverlapBg2,
@@ -157,6 +178,9 @@ const variations = applyFilters(
157178
{
158179
name: 'overlap-background-3',
159180
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Overlap Background 3', i18n ) ),
181+
attributes: {
182+
className: 'is-style-overlap-background-3',
183+
},
160184
isActive: [ 'className' ],
161185
pickerTitle: __( 'Overlap Background 3', i18n ),
162186
pickerIcon: ImageOverlapBg3,
@@ -166,6 +190,9 @@ const variations = applyFilters(
166190
{
167191
name: 'overlap-background-4',
168192
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Overlap Background 4', i18n ) ),
193+
attributes: {
194+
className: 'is-style-overlap-background-4',
195+
},
169196
isActive: [ 'className' ],
170197
pickerTitle: __( 'Overlap Background 4', i18n ),
171198
pickerIcon: ImageOverlapBg4,
@@ -175,6 +202,9 @@ const variations = applyFilters(
175202
{
176203
name: 'overlap-background-5',
177204
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Overlap Background 5', i18n ) ),
205+
attributes: {
206+
className: 'is-style-overlap-background-5',
207+
},
178208
isActive: [ 'className' ],
179209
pickerTitle: __( 'Overlap Background 5', i18n ),
180210
pickerIcon: ImageOverlapBg5,

src/block/hero/variations.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ const variations = applyFilters(
109109
{
110110
name: 'half-overlay',
111111
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Half Overlay', i18n ) ),
112+
attributes: {
113+
className: 'is-style-half-overlay',
114+
},
112115
isActive: [ 'className' ],
113116
pickerTitle: __( 'Half Overlay', i18n ),
114117
pickerIcon: ImageHalfOverlay,
@@ -118,6 +121,9 @@ const variations = applyFilters(
118121
{
119122
name: 'center-overlay',
120123
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Center Overlay', i18n ) ),
124+
attributes: {
125+
className: 'is-style-center-overlay',
126+
},
121127
isActive: [ 'className' ],
122128
pickerTitle: __( 'Center Overlay', i18n ),
123129
pickerIcon: ImageCenterOverlay,
@@ -127,6 +133,9 @@ const variations = applyFilters(
127133
{
128134
name: 'side-overlay',
129135
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Side Overlay', i18n ) ),
136+
attributes: {
137+
className: 'is-style-side-overlay',
138+
},
130139
isActive: [ 'className' ],
131140
pickerTitle: __( 'Side Overlay', i18n ),
132141
pickerIcon: ImageSideOverlay,
@@ -136,6 +145,9 @@ const variations = applyFilters(
136145
{
137146
name: 'half',
138147
description: __( 'Half Layout', i18n ),
148+
attributes: {
149+
className: 'is-style-half',
150+
},
139151
isActive: [ 'className' ],
140152
pickerTitle: __( 'Half', i18n ),
141153
pickerIcon: ImageHalf,

src/block/image-box/variations.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ const variations = applyFilters(
140140
{
141141
name: 'box',
142142
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Box', i18n ) ),
143+
attributes: {
144+
className: 'is-style-box',
145+
},
143146
pickerTitle: __( 'Box', i18n ),
144147
pickerIcon: ImageBox,
145148
isActive: [ 'className' ],
@@ -149,6 +152,9 @@ const variations = applyFilters(
149152
{
150153
name: 'captioned',
151154
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Captioned', i18n ) ),
155+
attributes: {
156+
className: 'is-style-captioned',
157+
},
152158
pickerTitle: __( 'Captioned', i18n ),
153159
pickerIcon: ImageCaptioned,
154160
isActive: [ 'className' ],
@@ -158,6 +164,9 @@ const variations = applyFilters(
158164
{
159165
name: 'fade',
160166
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Fade', i18n ) ),
167+
attributes: {
168+
className: 'is-style-fade',
169+
},
161170
pickerTitle: __( 'Fade', i18n ),
162171
pickerIcon: ImageFade,
163172
isActive: [ 'className' ],
@@ -167,6 +176,9 @@ const variations = applyFilters(
167176
{
168177
name: 'line',
169178
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Line', i18n ) ),
179+
attributes: {
180+
className: 'is-style-line',
181+
},
170182
pickerTitle: __( 'Line', i18n ),
171183
pickerIcon: ImageLine,
172184
isActive: [ 'className' ],

src/block/notification/variations.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ const variations = applyFilters(
117117
{
118118
name: 'side',
119119
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Side', i18n ) ),
120+
attributes: {
121+
className: 'is-style-side',
122+
},
120123
pickerTitle: __( 'Side', i18n ),
121124
pickerIcon: ImageSide,
122125
isActive: [ 'className' ],
@@ -126,6 +129,9 @@ const variations = applyFilters(
126129
{
127130
name: 'bordered',
128131
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Bordered', i18n ) ),
132+
attributes: {
133+
className: 'is-style-bordered',
134+
},
129135
pickerTitle: __( 'Bordered', i18n ),
130136
pickerIcon: ImageBordered,
131137
isActive: [ 'className' ],
@@ -135,6 +141,9 @@ const variations = applyFilters(
135141
{
136142
name: 'outlined',
137143
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Outlined', i18n ) ),
144+
attributes: {
145+
className: 'is-style-outlined',
146+
},
138147
pickerTitle: __( 'Outlined', i18n ),
139148
pickerIcon: ImageOutlined,
140149
isActive: [ 'className' ],
@@ -144,6 +153,9 @@ const variations = applyFilters(
144153
{
145154
name: 'large-icon',
146155
description: sprintf( _x( '%s Layout', 'Block layout name', i18n ), __( 'Large Icon', i18n ) ),
156+
attributes: {
157+
className: 'is-style-large-icon',
158+
},
147159
pickerTitle: __( 'Large Icon', i18n ),
148160
pickerIcon: ImageLargeIcon,
149161
isActive: [ 'className' ],

0 commit comments

Comments
 (0)