From 71d69af25c8d7a7f9acd6eb35d0663f3d1ac2a19 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Fri, 6 Dec 2019 13:41:06 +0100 Subject: [PATCH] Rename isToggled to isPressed for the Button component --- packages/base-styles/_z-index.scss | 6 ++--- .../src/components/media-placeholder/index.js | 2 +- .../src/components/url-input/button.js | 2 +- .../src/components/url-input/test/button.js | 8 +++---- .../src/heading/heading-level-icon.js | 4 ++-- .../src/heading/heading-toolbar.js | 2 +- packages/block-library/src/html/edit.js | 4 ++-- packages/block-library/src/image/edit.js | 4 ++-- .../src/legacy-widget/edit/index.js | 4 ++-- packages/components/src/button/README.md | 2 +- packages/components/src/button/index.js | 6 ++--- .../components/src/button/index.native.js | 10 ++++---- .../components/src/button/stories/index.js | 6 ++--- packages/components/src/button/test/index.js | 8 +++---- .../src/circular-option-picker/index.js | 2 +- .../src/circular-option-picker/style.scss | 6 ++--- .../test/__snapshots__/index.js.snap | 8 +++---- .../src/color-palette/test/index.js | 4 ++-- packages/components/src/date-time/style.scss | 4 ++-- .../date-time/test/__snapshots__/time.js.snap | 8 +++---- packages/components/src/date-time/time.js | 4 ++-- .../components/src/primitives/svg/index.js | 4 ++-- .../src/primitives/svg/index.native.js | 4 ++-- .../src/primitives/svg/style.native.scss | 2 +- .../components/src/toolbar-button/index.js | 2 +- .../components/src/toolbar-button/style.scss | 6 ++--- .../__snapshots__/plugins-api.test.js.snap | 4 ++-- .../edit-post/src/components/header/index.js | 2 +- .../header/pinned-plugins/style.scss | 14 +++++------ .../src/components/header/style.scss | 6 ++--- .../sidebar/plugin-sidebar/index.js | 4 ++-- storybook/test/__snapshots__/index.js.snap | 24 +++++++++---------- 32 files changed, 88 insertions(+), 88 deletions(-) diff --git a/packages/base-styles/_z-index.scss b/packages/base-styles/_z-index.scss index e60186330ca309..9bdedb9fe09d17 100644 --- a/packages/base-styles/_z-index.scss +++ b/packages/base-styles/_z-index.scss @@ -121,9 +121,9 @@ $z-layers: ( // Needs to appear bellow other color circular picker related UI elements. ".components-circular-option-picker__option-wrapper::before": -1, - ".components-circular-option-picker__option.is-toggled": 1, - // Needs to be higher than .components-circular-option-picker__option.is-toggled. - ".components-circular-option-picker__option.is-toggled + .dashicons-saved": 2 + ".components-circular-option-picker__option.is-pressed": 1, + // Needs to be higher than .components-circular-option-picker__option.is-pressed. + ".components-circular-option-picker__option.is-pressed + .dashicons-saved": 2 ); @function z-index( $key ) { diff --git a/packages/block-editor/src/components/media-placeholder/index.js b/packages/block-editor/src/components/media-placeholder/index.js index d4e98de6179b12..cb5fc3806f0301 100644 --- a/packages/block-editor/src/components/media-placeholder/index.js +++ b/packages/block-editor/src/components/media-placeholder/index.js @@ -272,7 +272,7 @@ export class MediaPlaceholder extends Component { + ); }; diff --git a/packages/components/src/button/test/index.js b/packages/components/src/button/test/index.js index 05e3580bfacbe6..27c5a24f490e87 100644 --- a/packages/components/src/button/test/index.js +++ b/packages/components/src/button/test/index.js @@ -21,7 +21,7 @@ describe( 'Button', () => { expect( button.hasClass( 'components-button' ) ).toBe( true ); expect( button.hasClass( 'is-large' ) ).toBe( false ); expect( button.hasClass( 'is-primary' ) ).toBe( false ); - expect( button.hasClass( 'is-toggled' ) ).toBe( false ); + expect( button.hasClass( 'is-pressed' ) ).toBe( false ); expect( button.prop( 'disabled' ) ).toBeUndefined(); expect( button.prop( 'type' ) ).toBe( 'button' ); expect( button.type() ).toBe( 'button' ); @@ -56,10 +56,10 @@ describe( 'Button', () => { expect( button.hasClass( 'is-primary' ) ).toBe( false ); } ); - it( 'should render a button element with is-toggled without button class', () => { - const button = shallow(
Sidebar title plugin
"`; +exports[`Using Plugins API Sidebar Medium screen Should open plugins sidebar using More Menu item and render content 1`] = `"
Sidebar title plugin
"`; -exports[`Using Plugins API Sidebar Should open plugins sidebar using More Menu item and render content 1`] = `"
Sidebar title plugin
"`; +exports[`Using Plugins API Sidebar Should open plugins sidebar using More Menu item and render content 1`] = `"
Sidebar title plugin
"`; diff --git a/packages/edit-post/src/components/header/index.js b/packages/edit-post/src/components/header/index.js index 52d9245be0a157..26dd1812d6b5ea 100644 --- a/packages/edit-post/src/components/header/index.js +++ b/packages/edit-post/src/components/header/index.js @@ -60,7 +60,7 @@ function Header( { icon="admin-generic" label={ __( 'Settings' ) } onClick={ toggleGeneralSidebar } - isToggled={ isEditorSidebarOpened } + isPressed={ isEditorSidebarOpened } aria-expanded={ isEditorSidebarOpened } shortcut={ shortcuts.toggleSidebar } /> diff --git a/packages/edit-post/src/components/header/pinned-plugins/style.scss b/packages/edit-post/src/components/header/pinned-plugins/style.scss index ea87a514227eaa..bd5268c0ea77c2 100644 --- a/packages/edit-post/src/components/header/pinned-plugins/style.scss +++ b/packages/edit-post/src/components/header/pinned-plugins/style.scss @@ -8,7 +8,7 @@ .components-icon-button { margin-left: 4px; - &.is-toggled { + &.is-pressed { margin-left: 5px; } @@ -19,18 +19,18 @@ } // Colorize plugin icons to ensure contrast and cohesion, but allow plugin developers to override. - .components-icon-button:not(.is-toggled) svg, - .components-icon-button:not(.is-toggled) svg * { + .components-icon-button:not(.is-pressed) svg, + .components-icon-button:not(.is-pressed) svg * { stroke: $dark-gray-500; fill: $dark-gray-500; stroke-width: 0; // !important is omitted here, so stroke-only icons can override easily. } // Forcefully colorize hover and toggled plugin icon states to ensure legibility and consistency. - .components-icon-button.is-toggled svg, - .components-icon-button.is-toggled svg *, - .components-icon-button.is-toggled:hover svg, - .components-icon-button.is-toggled:hover svg * { + .components-icon-button.is-pressed svg, + .components-icon-button.is-pressed svg *, + .components-icon-button.is-pressed:hover svg, + .components-icon-button.is-pressed:hover svg * { stroke: $white !important; fill: $white !important; stroke-width: 0; // !important is omitted here, so stroke-only icons can override easily. diff --git a/packages/edit-post/src/components/header/style.scss b/packages/edit-post/src/components/header/style.scss index b5eaa5049e058f..45e5eb1893b5b3 100644 --- a/packages/edit-post/src/components/header/style.scss +++ b/packages/edit-post/src/components/header/style.scss @@ -49,14 +49,14 @@ .edit-post-header .components-button { // Header toggle buttons. - &.is-toggled { + &.is-pressed { color: $white; background: $dark-gray-500; } // The !important in this ruleset need to override the pile of :not() selectors used in the icon-button. - &.is-toggled:hover, - &.is-toggled:focus { + &.is-pressed:hover, + &.is-pressed:focus { box-shadow: 0 0 0 $border-width $dark-gray-500, inset 0 0 0 $border-width $white !important; color: $white !important; background: $dark-gray-500 !important; diff --git a/packages/edit-post/src/components/sidebar/plugin-sidebar/index.js b/packages/edit-post/src/components/sidebar/plugin-sidebar/index.js index a112ea053b2df4..94754a4dc05405 100644 --- a/packages/edit-post/src/components/sidebar/plugin-sidebar/index.js +++ b/packages/edit-post/src/components/sidebar/plugin-sidebar/index.js @@ -36,7 +36,7 @@ function PluginSidebar( props ) { icon={ icon } label={ title } onClick={ toggleSidebar } - isToggled={ isActive } + isPressed={ isActive } aria-expanded={ isActive } /> } @@ -51,7 +51,7 @@ function PluginSidebar( props ) { icon={ isPinned ? 'star-filled' : 'star-empty' } label={ isPinned ? __( 'Unpin from toolbar' ) : __( 'Pin to toolbar' ) } onClick={ togglePin } - isToggled={ isPinned } + isPressed={ isPinned } aria-expanded={ isPinned } /> ) } diff --git a/storybook/test/__snapshots__/index.js.snap b/storybook/test/__snapshots__/index.js.snap index a6f53cc9beb2a5..707b97a8e35f95 100644 --- a/storybook/test/__snapshots__/index.js.snap +++ b/storybook/test/__snapshots__/index.js.snap @@ -336,31 +336,31 @@ exports[`Storyshots Components|Button Link 1`] = ` `; -exports[`Storyshots Components|Button Primary 1`] = ` +exports[`Storyshots Components|Button Pressed 1`] = ` `; -exports[`Storyshots Components|Button Small 1`] = ` +exports[`Storyshots Components|Button Primary 1`] = ` `; -exports[`Storyshots Components|Button Toggled 1`] = ` +exports[`Storyshots Components|Button Small 1`] = ` `; @@ -3728,7 +3728,7 @@ exports[`Storyshots Components|ToolbarGroup Default 1`] = `