generated from Seekra/repository-template
Move the search bar in the search results view into the navigation bar #82
@@ -15,9 +15,25 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
import ColorSchemeButton from '@/features/colorScheme/components/ColorSchemeButton.vue';
|
import ColorSchemeButton from '@/features/colorScheme/components/ColorSchemeButton.vue';
|
||||||
import LanguageSwitchButton from '@/features/i18n/components/LanguageSwitchButton.vue';
|
import LanguageSwitchButton from '@/features/i18n/components/LanguageSwitchButton.vue';
|
||||||
import logo from '@/assets/images/logo.svg';
|
import logo from '@/assets/images/logo.svg';
|
||||||
|
import Searchbar from '@/features/search/components/Searchbar.vue';
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const searchQueryModel = defineModel();
|
||||||
|
|
||||||
|
watch(() => route.name, name => {
|
||||||
|
searchQueryModel.value = name === 'searchResults' ? route.query.q || '' : '';
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(() => route.query.q, q => {
|
||||||
|
if (route.name === 'searchResults') {
|
||||||
|
searchQueryModel.value = q || '';
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -25,6 +41,12 @@ import logo from '@/assets/images/logo.svg';
|
|||||||
<RouterLink to="/" class="link button link">
|
<RouterLink to="/" class="link button link">
|
||||||
<img :src="logo" alt="Seekra" class="nav-logo" />
|
<img :src="logo" alt="Seekra" class="nav-logo" />
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
|
<Searchbar
|
||||||
|
v-if="route.name === 'searchResults'"
|
||||||
|
class="search-bar"
|
||||||
|
v-model="searchQueryModel"
|
||||||
|
auto-submit
|
||||||
|
/>
|
||||||
<ul class="right-links">
|
<ul class="right-links">
|
||||||
<li>
|
<li>
|
||||||
<LanguageSwitchButton />
|
<LanguageSwitchButton />
|
||||||
@@ -41,7 +63,8 @@ import logo from '@/assets/images/logo.svg';
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 10px 40px;
|
padding: 18px 40px;
|
||||||
|
height: 42px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.global-nav .right-links {
|
.global-nav .right-links {
|
||||||
@@ -66,4 +89,7 @@ import logo from '@/assets/images/logo.svg';
|
|||||||
height: 24px;
|
height: 24px;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
</style>
|
.search-bar {
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -15,22 +15,13 @@ limitations under the License.
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import Searchbar from '@/features/search/components/Searchbar.vue';
|
|
||||||
|
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const props = defineProps(['searchQuery']);
|
|
||||||
|
|
||||||
const searchQueryModel = defineModel();
|
|
||||||
searchQueryModel.value = props.searchQuery;
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="main-content-padding">
|
<div class="main-content-padding">
|
||||||
<Searchbar class="search-bar" v-model="searchQueryModel" auto-submit />
|
|
||||||
|
|
||||||
<div class="search-results-error-message-container">
|
<div class="search-results-error-message-container">
|
||||||
<div class="search-results-error-message">
|
<div class="search-results-error-message">
|
||||||
<p>{{ t('search.error.searchNotAvailable') }}</p>
|
<p>{{ t('search.error.searchNotAvailable') }}</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user