Skip to content

Commit

Permalink
Search Block: Removed components class from icon button and polished …
Browse files Browse the repository at this point in the history
…css (#33961)

* removed components classes from icon button, polished css

* changed frontend styles to not use editor variables for paddings

* removed variables for colors too
  • Loading branch information
MaggieCabrera authored Aug 10, 2021
1 parent e8c73eb commit 0be70f3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
13 changes: 8 additions & 5 deletions packages/block-library/src/search/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
__experimentalUseCustomUnits as useCustomUnits,
} from '@wordpress/components';
import { useInstanceId } from '@wordpress/compose';
import { search } from '@wordpress/icons';
import { Icon, search } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';

/**
Expand Down Expand Up @@ -211,7 +211,8 @@ export default function SearchEdit( {
const buttonClasses = classnames(
'wp-block-search__button',
colorProps.className,
isButtonPositionInside ? undefined : borderProps.className
isButtonPositionInside ? undefined : borderProps.className,
buttonUseIcon ? 'has-icon' : undefined
);
const buttonStyles = {
...colorProps.style,
Expand All @@ -223,11 +224,13 @@ export default function SearchEdit( {
return (
<>
{ buttonUseIcon && (
<Button
icon={ search }
<button
type="button"
className={ buttonClasses }
style={ buttonStyles }
/>
>
<Icon icon={ search } />
</button>
) }

{ ! buttonUseIcon && (
Expand Down
18 changes: 2 additions & 16 deletions packages/block-library/src/search/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,11 @@
}

.wp-block-search {
.wp-block-search__input {
padding: $grid-unit-10;
}

&.wp-block-search__button-inside .wp-block-search__inside-wrapper {
padding: $grid-unit-05;
}

.wp-block-search__button {
height: auto;
border-radius: initial;

// This needs high specificity because it otherwise inherits styles from `components-button`.
// stylelint-disable-line no-duplicate-selectors
&.wp-block-search__button.wp-block-search__button {
padding: 6px 10px;
display: flex;
align-items: center;
}
display: flex;
align-items: center;
}

&__components-button-group {
Expand Down
7 changes: 4 additions & 3 deletions packages/block-library/src/search/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
}

.wp-block-search__input {
padding: 8px;
flex-grow: 1;
min-width: 3em;
border: 1px solid $gray-600;
border: 1px solid #949494;
}

&.wp-block-search__button-only {
Expand All @@ -43,8 +44,8 @@
}

&.wp-block-search__button-inside .wp-block-search__inside-wrapper {
padding: $grid-unit-05;
border: 1px solid $gray-600;
padding: 4px;
border: 1px solid #949494;

.wp-block-search__input {
border-radius: 0;
Expand Down

0 comments on commit 0be70f3

Please sign in to comment.