-
Notifications
You must be signed in to change notification settings - Fork 13
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
[R20-1952][R20-1954] add support for extending search bar #1158
Merged
dylankelly
merged 7 commits into
develop
from
feature/R20-1952-search-term-extension-conf
May 27, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ca7e4ad
feat(@dpc-sdp/ripple-tide-search): add support for overriding the sea…
9c4d6e2
feat(@dpc-sdp/ripple-ui-core): add prop to manage clear btn for searc…
84a13cd
feat(@dpc-sdp/ripple-tide-search): allow showing only filters on list…
f1377b3
Merge branch 'develop' into feature/R20-1952-search-term-extension-conf
lambry 57efe9a
feat(@dpc-sdp/ripple-tide-search): update query config functions to a…
6613708
Merge branch 'develop' into feature/R20-1952-search-term-extension-conf
lambry c4e77bc
feat(@dpc-sdp/ripple-tide-search): always give custom query config fu…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
examples/nuxt-app/components/global/TideSearchBarComponentExample.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<template> | ||
<div class="tide-search-bar-component-example"> | ||
<RplSearchBar | ||
:id="id" | ||
:variant="variant" | ||
:input-label="inputLabel" | ||
:input-value="inputValue.q" | ||
:placeholder="placeholder" | ||
:suggestions="suggestions" | ||
:global-events="globalEvents" | ||
:show-clear-button="false" | ||
@submit="handleSubmit" | ||
@update:input-value="handleUpdate" | ||
> | ||
<template #afterInput> | ||
<label for="query-type" class="rpl-u-visually-hidden"> | ||
Select a search type | ||
</label> | ||
<RplFormDropdown | ||
id="query-type" | ||
label-id="query-type-label-id" | ||
:multiple="false" | ||
:value="props.inputValue.queryType || 'title_content'" | ||
:options="[ | ||
{ | ||
id: 'title_content', | ||
label: 'Title and content', | ||
value: 'title_content' | ||
}, | ||
{ | ||
id: 'title', | ||
label: 'Title', | ||
value: 'title' | ||
}, | ||
{ | ||
id: 'content', | ||
label: 'Content', | ||
value: 'content' | ||
} | ||
]" | ||
@onChange="handleChange" | ||
/> | ||
</template> | ||
</RplSearchBar> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
interface Props { | ||
id: string | ||
variant?: string | ||
inputLabel: string | ||
inputValue: Record<string, any> | ||
placeholder: string | ||
suggestions: any[] | ||
globalEvents: boolean | ||
handleSubmit: (event: any) => void | ||
handleUpdate: (event: any) => void | ||
} | ||
|
||
const props = withDefaults(defineProps<Props>(), { | ||
variant: 'default' | ||
}) | ||
|
||
const handleChange = (value: string) => props.handleUpdate({ queryType: value }) | ||
</script> | ||
|
||
<style> | ||
@import '@dpc-sdp/ripple-ui-core/style/breakpoints'; | ||
|
||
.tide-search-bar-component-example { | ||
.rpl-search-bar__inner { | ||
display: grid; | ||
grid-template-columns: 1fr auto; | ||
gap: 0 var(--rpl-sp-4); | ||
|
||
@media (--rpl-bp-l) { | ||
display: flex; | ||
align-items: center; | ||
} | ||
} | ||
|
||
.rpl-form-dropdown { | ||
order: 1; | ||
grid-column: span 2; | ||
|
||
@media (--rpl-bp-l) { | ||
width: 210px; | ||
order: initial; | ||
} | ||
|
||
.rpl-form-dropdown__chevron { | ||
right: var(--local-search-bar-inline-padding); | ||
} | ||
|
||
&-input { | ||
height: auto; | ||
border-radius: 0; | ||
padding-block: var(--local-search-bar-block-padding); | ||
padding-inline: var(--local-search-bar-inline-padding); | ||
|
||
&:not(:focus):not(.rpl-u-focusable--force-on) { | ||
border-color: transparent; | ||
border-top-color: var(--rpl-clr-neutral-200); | ||
} | ||
|
||
@media (--rpl-bp-l) { | ||
padding: var(--rpl-sp-1) var(--rpl-sp-3); | ||
|
||
&:not(:focus):not(.rpl-u-focusable--force-on) { | ||
border-top-color: transparent; | ||
border-left-color: var(--rpl-clr-neutral-300); | ||
border-right-color: var(--rpl-clr-neutral-300); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
examples/nuxt-app/test/features/search-listing/search-query.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Feature: Search Queries | ||
|
||
Background: | ||
Given the site endpoint returns fixture "/site/reference" with status 200 | ||
And I am using a "macbook-16" device | ||
|
||
@mockserver | ||
Example: The search term query can be extended and a custom query config supplied | ||
Given the page endpoint for path "/" returns fixture "/search-listing/search-query/page" with status 200 | ||
And the search network request is stubbed with fixture "/search-listing/search-query/response" and status 200 | ||
|
||
When I visit the page "/" | ||
And the search network request should be called with the "/search-listing/search-query/request-initial" fixture | ||
Then the search listing page should have 2 results | ||
|
||
When I type "Demo" into the search input | ||
And I click the search button | ||
Then the URL should reflect that the current active filters are as follows: | ||
| id | value | | ||
| q | Demo | | ||
And the search network request should be called with the "/search-listing/search-query/request-title-content" fixture | ||
|
||
When I click the search listing dropdown field labelled "Select a search type" | ||
Then the selected dropdown field should have the items: | ||
| Title and content | | ||
| Title | | ||
| Content | | ||
Then I click the option labelled "Content" in the selected dropdown | ||
And I click the search button | ||
|
||
Then the URL should reflect that the current active filters are as follows: | ||
| id | value | | ||
| q | Demo | | ||
| search[queryType] | content | | ||
And the search network request should be called with the "/search-listing/search-query/request-content" fixture | ||
|
||
When I toggle the search listing filters section | ||
And I clear the search filters | ||
And the search network request should be called with the "/search-listing/search-query/request-initial" fixture |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is picky but I still think that:
And the custom collection is set to only show filters
is more future proof, even though you need to add more step definitions.
If "showFiltersOnly" ever changes we'll have to update it anywhere it's reference