Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Forms: add examples for first/last name field variations
33 changes: 33 additions & 0 deletions projects/packages/forms/src/blocks/field-name/variations.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const variations = [
description: __( 'Collect the visitor’s name.', 'jetpack-forms' ),
icon,
scope: [ 'transform' ],
isActive: ( { id } ) => ! [ FIRST_NAME_ID, LAST_NAME_ID ].includes( id ),
attributes: {
id: '',
},
Expand All @@ -46,6 +47,22 @@ const variations = [
[ 'jetpack/label', { label: DEFAULT_FIRST_NAME_LABEL } ],
[ 'jetpack/input', { type: 'text' } ],
],
example: {
innerBlocks: [
{
name: 'jetpack/label',
attributes: {
label: DEFAULT_FIRST_NAME_LABEL,
},
},
{
name: 'jetpack/input',
attributes: {
type: 'text',
},
},
],
},
},
{
name: LAST_NAME_ID,
Expand All @@ -61,6 +78,22 @@ const variations = [
[ 'jetpack/label', { label: DEFAULT_LAST_NAME_LABEL } ],
[ 'jetpack/input', { type: 'text' } ],
],
example: {
innerBlocks: [
{
name: 'jetpack/label',
attributes: {
label: DEFAULT_LAST_NAME_LABEL,
},
},
{
name: 'jetpack/input',
attributes: {
type: 'text',
},
},
],
},
},
];

Expand Down
Loading