-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group: Update block example #63114
Group: Update block example #63114
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,59 @@ | |
import { __, _x } from '@wordpress/i18n'; | ||
import { group, row, stack, grid } from '@wordpress/icons'; | ||
|
||
const example = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's used for previewing the different block variations in the block inserter. Steps 5 - 8 in the test instructions cover this aspect. To save you having to fire up the PR locally you can see the original example with the main block inserter from the 30s mark on in the description's demo video. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be easier still 🙂 Screen.Recording.2024-07-29.at.5.10.47.PM.mp4 |
||
innerBlocks: [ | ||
{ | ||
name: 'core/paragraph', | ||
attributes: { | ||
customTextColor: '#cf2e2e', | ||
fontSize: 'large', | ||
content: __( 'One.' ), | ||
}, | ||
}, | ||
{ | ||
name: 'core/paragraph', | ||
attributes: { | ||
customTextColor: '#ff6900', | ||
fontSize: 'large', | ||
content: __( 'Two.' ), | ||
}, | ||
}, | ||
{ | ||
name: 'core/paragraph', | ||
attributes: { | ||
customTextColor: '#fcb900', | ||
fontSize: 'large', | ||
content: __( 'Three.' ), | ||
}, | ||
}, | ||
{ | ||
name: 'core/paragraph', | ||
attributes: { | ||
customTextColor: '#00d084', | ||
fontSize: 'large', | ||
content: __( 'Four.' ), | ||
}, | ||
}, | ||
{ | ||
name: 'core/paragraph', | ||
attributes: { | ||
customTextColor: '#0693e3', | ||
fontSize: 'large', | ||
content: __( 'Five.' ), | ||
}, | ||
}, | ||
{ | ||
name: 'core/paragraph', | ||
attributes: { | ||
customTextColor: '#9b51e0', | ||
fontSize: 'large', | ||
content: __( 'Six.' ), | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
const variations = [ | ||
{ | ||
name: 'group', | ||
|
@@ -30,6 +83,7 @@ const variations = [ | |
( ! blockAttributes.layout?.orientation || | ||
blockAttributes.layout?.orientation === 'horizontal' ), | ||
icon: row, | ||
example, | ||
}, | ||
{ | ||
name: 'group-stack', | ||
|
@@ -41,6 +95,7 @@ const variations = [ | |
blockAttributes.layout?.type === 'flex' && | ||
blockAttributes.layout?.orientation === 'vertical', | ||
icon: stack, | ||
example, | ||
}, | ||
{ | ||
name: 'group-grid', | ||
|
@@ -51,6 +106,7 @@ const variations = [ | |
isActive: ( blockAttributes ) => | ||
blockAttributes.layout?.type === 'grid', | ||
icon: grid, | ||
example, | ||
}, | ||
]; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple and looking pretty good.
2024-07-04.19.10.21.mp4