Use existing freefilter to match existing design

pull/14947/head
Michael Klein 2 years ago
parent 71e20c3122
commit 9030c32164

@ -23,18 +23,15 @@
<BlockSlot @name="loaded">
{{#if items.length}}
<div
class="hds-surface-faint flex h-12 py-1.5 px-1 border-t border-b border-hds-border-primary"
>
<div>
<Hds::Form::TextInput::Field
@type="search"
<div class="search-bar">
<form class="filter-bar">
<FreetextFilter
@onsearch={{pick "target.value" this.updateSearch}}
@value={{this.search}}
placeholder="Search"
class="rounded-sm border-hds-border-faint"
{{on "input" (pick "target.value" this.updateSearch)}}
@placeholder="Search"
class="!w-80"
/>
</div>
</form>
</div>
{{/if}}
<Providers::Search
@ -56,9 +53,7 @@
@items={{search.data.items}}
as |service index|
>
<li
class="px-3 h-12 border-b border-hds-border-primary border-b"
>
<li class="px-3 h-12 border-b border-hds-border-primary">
<a
data-test-service-name
class="hds-typography-display-300 text-hds-foreground-strong hds-font-weight-semibold h-full w-full flex items-center"

@ -11,11 +11,9 @@ export default class SearchProvider extends Component {
const { _search: search } = this;
if (search.length > 0) {
const regex = new RegExp(`${search}`, 'ig');
return items.filter((item) => {
const matchesInSearchProperties = searchProperties.reduce((acc, searchProperty) => {
const match = item[searchProperty].match(regex);
const match = item[searchProperty].indexOf(search) !== -1;
if (match) {
return [...acc, match];
} else {

Loading…
Cancel
Save