diff --git a/packages/edit-site/src/components/style-book/button-examples.tsx b/packages/edit-site/src/components/style-book/button-examples.tsx index 22fdedb578c79..98a4b8bd33e52 100644 --- a/packages/edit-site/src/components/style-book/button-examples.tsx +++ b/packages/edit-site/src/components/style-book/button-examples.tsx @@ -19,23 +19,43 @@ const { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock( blockEditorPrivateApis ); -const BUTTON_STATE_NAMES = [ - 'default', - ':active', - ':any-link', - ':focus', - ':hover', - ':link', - ':visited', +const BUTTON_STATES = [ + { + key: 'default', + title: __( 'Button' ), + }, + { + key: ':active', + title: __( 'Button (Active)' ), + }, + { + key: ':any-link', + title: __( 'Button (Any Link)' ), + }, + { + key: ':focus', + title: __( 'Button (Focus)' ), + }, + { + key: ':hover', + title: __( 'Button (Hover)' ), + }, + { + key: ':link', + title: __( 'Button (Link)' ), + }, + { + key: ':visited', + title: __( 'Button (Visited)' ), + }, ]; function ButtonExamples() { const [ elementsButton ] = useGlobalStyle( 'elements.button' ); - const blocks = BUTTON_STATE_NAMES.map( ( state ) => { + const blocks = BUTTON_STATES.map( ( { key } ) => { const styles = - ( state !== 'default' - ? elementsButton[ state ] - : elementsButton ) || {}; + ( key !== 'default' ? elementsButton[ key ] : elementsButton ) || + {}; return createBlock( 'core/button', { text: __( 'Call to Action' ), style: styles, @@ -44,15 +64,14 @@ function ButtonExamples() { return ( - { blocks.map( ( block, key ) => ( - + { blocks.map( ( block, index ) => ( + + + { BUTTON_STATES[ index ].title } + - - - { BUTTON_STATE_NAMES[ key ] } - ) ) }