Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search Block: Removed components class from icon button and polished css #33961

Merged
merged 3 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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