diff --git a/packages/base-styles/_mixins.scss b/packages/base-styles/_mixins.scss index 74974a84254ec5..bbae5daa274121 100644 --- a/packages/base-styles/_mixins.scss +++ b/packages/base-styles/_mixins.scss @@ -667,6 +667,23 @@ } } +@mixin inserter-toggle() { + // Basic look + background: colors.$gray-900; + color: colors.$white; + padding: 0; + + // TODO: Consider passing size="small" to the Inserter toggle instead. + // Special dimensions for this button. + min-width: variables.$button-size-small; + height: variables.$button-size-small; + + &:hover { + color: colors.$white; + background: var(--wp-admin-theme-color); + } +} + @mixin selected-block-outline($widthRatio: 1) { outline-color: var(--wp-admin-theme-color); outline-style: solid; diff --git a/packages/block-editor/src/components/block-tools/style.scss b/packages/block-editor/src/components/block-tools/style.scss index 8d3f5b9e2cd12e..2cdf3e7096ce39 100644 --- a/packages/block-editor/src/components/block-tools/style.scss +++ b/packages/block-editor/src/components/block-tools/style.scss @@ -76,20 +76,7 @@ .block-editor-block-list__empty-block-inserter, .block-editor-block-list__insertion-point-inserter { .block-editor-inserter__toggle.components-button.has-icon { - // Basic look - background: $gray-900; - color: $white; - padding: 0; - - // TODO: Consider passing size="small" to the Inserter toggle instead. - // Special dimensions for this button. - min-width: $button-size-small; - height: $button-size-small; - - &:hover { - color: $white; - background: var(--wp-admin-theme-color); - } + @include inserter-toggle; } } diff --git a/packages/block-editor/src/components/default-block-appender/content.scss b/packages/block-editor/src/components/default-block-appender/content.scss index c94a8f21c17345..211202d40218d0 100644 --- a/packages/block-editor/src/components/default-block-appender/content.scss +++ b/packages/block-editor/src/components/default-block-appender/content.scss @@ -1,4 +1,5 @@ @use "@wordpress/base-styles/colors" as *; +@use "@wordpress/base-styles/mixins" as *; @use "@wordpress/base-styles/variables" as *; @use "@wordpress/base-styles/z-index" as *; @@ -41,20 +42,7 @@ } .block-editor-inserter__toggle.components-button.has-icon { - // Basic look - background: $gray-900; - color: $white; - padding: 0; - - // TODO: Consider passing size="small" to the Inserter toggle instead. - // Special dimensions for this button. - min-width: $button-size-small; - height: $button-size-small; - - &:hover { - color: $white; - background: var(--wp-admin-theme-color); - } + @include inserter-toggle; } } @@ -103,26 +91,16 @@ // treating them the same, one or both can be retired. .block-editor-inserter__toggle.components-button.has-icon, .block-list-appender__toggle { + @include inserter-toggle; flex-direction: row; box-shadow: none; - height: $button-size-small; width: $button-size-small; - min-width: $button-size-small; // Hide by default, then we unhide it when the selected block is a direct ancestor. display: none; // Important to override styles form Button component. padding: 0 !important; - - // Basic look - background: $gray-900; - color: $white; - - &:hover { - color: $white; - background: var(--wp-admin-theme-color); - } } // This content only shows up inside the empty appender.