-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Block Library - Heading]: Add heading levels as block variations #33811
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { sprintf, __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import HeadingLevelIcon from './heading-level-icon'; | ||
|
||
const variations = [ 1, 2, 3, 4, 5, 6 ].map( ( level ) => ( { | ||
name: `heading-${ level }`, | ||
title: sprintf( | ||
/* translators: %d: heading level. */ | ||
__( 'Heading %d' ), | ||
level | ||
), | ||
icon: <HeadingLevelIcon level={ level } />, | ||
attributes: { level }, | ||
scope: [ 'inserter' ], | ||
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. Do we want to include 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. Yeah, this can be discussed as well. I intentionally left it out for start, as I thought it was not so much needed -but of course that was a personal opinion 😄 |
||
} ) ); | ||
|
||
export default variations; |
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.
Aside: @gwwar, if we had better handling for icons, we could keep put those variations in
block.json
. Well, JS offers loops that make encoding those variations simpler. The downside is that variations aren't exposed on the server.