2018-02-07 04:54:49 +00:00
|
|
|
<form class="search-input-form" on:submit="onSubmit(event)">
|
|
|
|
<div class="search-input-wrapper">
|
|
|
|
<input type="search"
|
|
|
|
class="search-input"
|
|
|
|
placeholder="Search"
|
|
|
|
aria-label="Search input"
|
|
|
|
required
|
|
|
|
bind:value="$queryInSearch">
|
|
|
|
</div>
|
2018-05-02 01:05:36 +01:00
|
|
|
<button type="submit" class="primary search-button" aria-label="Search" disabled={$searchLoading}>
|
2018-03-16 15:42:10 +00:00
|
|
|
<svg class="search-button-svg">
|
2018-02-07 04:54:49 +00:00
|
|
|
<use xlink:href="#fa-search" />
|
|
|
|
</svg>
|
|
|
|
</button>
|
|
|
|
</form>
|
2018-05-02 01:05:36 +01:00
|
|
|
{#if $searchLoading}
|
2018-02-07 04:54:49 +00:00
|
|
|
<div class="search-results-container">
|
|
|
|
<LoadingPage />
|
|
|
|
</div>
|
2018-05-02 01:05:36 +01:00
|
|
|
{:elseif $searchResults && $searchResultsForQuery === $queryInSearch}
|
2018-02-07 04:54:49 +00:00
|
|
|
<div class="search-results-container">
|
|
|
|
<SearchResults />
|
|
|
|
</div>
|
2018-05-02 01:05:36 +01:00
|
|
|
{/if}
|
2018-02-07 04:54:49 +00:00
|
|
|
<style>
|
|
|
|
.search-input-form {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr min-content;
|
|
|
|
grid-gap: 10px;
|
|
|
|
}
|
|
|
|
.search-input-wrapper {
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
.search-input {
|
|
|
|
padding: 10px 15px;
|
|
|
|
border-radius: 10px;
|
|
|
|
flex: 1;
|
|
|
|
}
|
2018-03-16 15:42:10 +00:00
|
|
|
.search-button-svg {
|
2018-02-07 04:54:49 +00:00
|
|
|
fill: var(--button-primary-text);
|
|
|
|
width: 18px;
|
|
|
|
height: 18px;
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
.search-results-container {
|
|
|
|
position: relative;
|
|
|
|
margin-top: 20px;
|
|
|
|
}
|
|
|
|
@media (min-width: 768px) {
|
|
|
|
.search-button {
|
|
|
|
min-width: 100px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
import { store } from '../../_store/store'
|
|
|
|
import LoadingPage from '../LoadingPage.html'
|
2018-02-11 18:41:01 +00:00
|
|
|
import { doSearch } from '../../_actions/search'
|
2018-02-07 04:54:49 +00:00
|
|
|
import SearchResults from './SearchResults.html'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
store: () => store,
|
|
|
|
components: {
|
|
|
|
LoadingPage,
|
|
|
|
SearchResults
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async onSubmit (e) {
|
|
|
|
e.preventDefault()
|
2018-02-11 18:41:01 +00:00
|
|
|
doSearch()
|
2018-02-07 04:54:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|