Skip to content

Commit

Permalink
Update: Expand search on list view.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Jul 22, 2024
1 parent bced5e0 commit 74942dd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/dataviews/src/components/dataviews-search/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* External dependencies
*/
import classnames from 'clsx';

/**
* WordPress dependencies
*/
Expand All @@ -10,6 +15,7 @@ import { useDebouncedInput } from '@wordpress/compose';
* Internal dependencies
*/
import DataViewsContext from '../dataviews-context';
import { LAYOUT_LIST } from '../../constants';

interface SearchProps {
label?: string;
Expand Down Expand Up @@ -37,8 +43,12 @@ const DataViewsSearch = memo( function Search( { label }: SearchProps ) {
} );
}, [ debouncedSearch ] );
const searchLabel = label || __( 'Search' );

return (
<SearchControl
className={ classnames( 'dataviews-search', {
'is-expanded': view.type === LAYOUT_LIST,
} ) }
__nextHasNoMarginBottom
onChange={ setSearch }
value={ search }
Expand Down
3 changes: 3 additions & 0 deletions packages/dataviews/src/components/dataviews-search/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.dataviews-search.is-expanded .components-base-control__field {
max-width: unset;
}
1 change: 1 addition & 0 deletions packages/dataviews/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@import "./components/dataviews-bulk-actions/style.scss";
@import "./components/dataviews-bulk-actions-toolbar/style.scss";
@import "./components/dataviews-filters/style.scss";
@import "./components/dataviews-search/style.scss";
@import "./components/dataviews-pagination/style.scss";
@import "./components/dataviews-item-actions/style.scss";
@import "./components/dataviews-selection-checkbox/style.scss";
Expand Down

0 comments on commit 74942dd

Please sign in to comment.