woocommerce/plugins/woocommerce-blocks/assets/js/editor-components/text-toolbar-button
Rua Haszard 5c7447f434 Rename js/components to js/editor-components (https://github.com/woocommerce/woocommerce-blocks/pull/3069)
* mass-rename js/components => js/editor-components & update webpack

* mass-change import '@woocommerce/editor-components' +
+ jsprettier quotes fix

* more mass-rename @woocommerce/editor-components

* fix up references to js/editor-components in various places:
- docs/readmes
- jest config
- typescritp config

* fix story path to match new folder/alias 'editor-components'

* fix jest tests: use new alias for editor-components

* include renamed `editor-components` in editor stylesheet cache group
2020-09-02 10:21:46 +02:00
..
README.md Rename js/components to js/editor-components (https://github.com/woocommerce/woocommerce-blocks/pull/3069) 2020-09-02 10:21:46 +02:00
index.js Rename js/components to js/editor-components (https://github.com/woocommerce/woocommerce-blocks/pull/3069) 2020-09-02 10:21:46 +02:00
style.scss Rename js/components to js/editor-components (https://github.com/woocommerce/woocommerce-blocks/pull/3069) 2020-09-02 10:21:46 +02:00

README.md

TextToolbarButton

TextToolbarButton is used in Toolbar for text buttons which show isToggled state.

Notes:

  • Gutenberg core has ToolbarGroup and ToolbarButton in progress. When these are available this component may not be needed.
  • Gutenberg core html block uses regular Button in toolbar, and sets is-active class to trigger "active" styling when button is toggled on.

Usage

Example: two text buttons to select edit modes for cart block.

<BlockControls>
  <Toolbar>
    <TextToolbarButton
      onClick={ toggleFullCartMode }
      isToggled={ isFullCartMode }>
      {  __(
        'Full Cart',
        'woo-gutenberg-products-block'
      ) }
    </TextToolbarButton>
    <TextToolbarButton
      onClick={ toggleFullCartMode }
      isToggled={ ! isFullCartMode }>
      {  __(
        'Empty Cart',
        'woo-gutenberg-products-block'
      ) }
    </TextToolbarButton>
  </Toolbar>
</BlockControls>