generated from Seekra/repository-template
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
946251799b
|
|||
|
0ff1e58221
|
|||
|
0f2d503862
|
|||
|
2f59d62e6a
|
|||
|
9dfefdba1c
|
|||
|
8616af132d
|
@@ -15,9 +15,24 @@ 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 logo from '@/assets/images/logo.svg';
|
import logo from '@/assets/images/logo.svg';
|
||||||
import NavbarSearchBarWrapper from './NavbarSearchBarWrapper.vue';
|
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,16 +40,18 @@ import NavbarSearchBarWrapper from './NavbarSearchBarWrapper.vue';
|
|||||||
<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>
|
||||||
<NavbarSearchBarWrapper class="navbar-search-bar-wrapper" />
|
<Searchbar
|
||||||
|
v-if="route.name === 'searchResults'"
|
||||||
|
class="search-bar"
|
||||||
|
v-model="searchQueryModel"
|
||||||
|
auto-submit
|
||||||
|
/>
|
||||||
<ul class="right-links">
|
<ul class="right-links">
|
||||||
<li>
|
<li>
|
||||||
<ColorSchemeButton />
|
<ColorSchemeButton />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="navbar-search-bar-wrapper-small-screens-wrapper">
|
|
||||||
<NavbarSearchBarWrapper class="navbar-search-bar-wrapper-small-screens" />
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@@ -68,27 +85,7 @@ import NavbarSearchBarWrapper from './NavbarSearchBarWrapper.vue';
|
|||||||
height: 24px;
|
height: 24px;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
.search-bar {
|
||||||
.navbar-search-bar-wrapper {
|
width: 70%;
|
||||||
width: 100%;
|
|
||||||
padding: 0 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-search-bar-wrapper-small-screens-wrapper {
|
|
||||||
padding: 0 15px 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-search-bar-wrapper-small-screens {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 48rem) {
|
|
||||||
.navbar-search-bar-wrapper {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-search-bar-wrapper-small-screens {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright 2026 Seekra
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import Searchbar from '@/features/search/components/Searchbar.vue';
|
|
||||||
|
|
||||||
import { watch } from 'vue';
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
|
|
||||||
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>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Searchbar
|
|
||||||
v-if="route.name === 'searchResults'"
|
|
||||||
v-model="searchQueryModel"
|
|
||||||
auto-submit
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
@@ -39,7 +39,7 @@ const submitSearch = function () {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<form @submit.prevent="submitSearch" class="search-form">
|
<form @submit.prevent="submitSearch">
|
||||||
<div class="search-wrapper">
|
<div class="search-wrapper">
|
||||||
<input
|
<input
|
||||||
v-model="searchQuery"
|
v-model="searchQuery"
|
||||||
@@ -108,8 +108,4 @@ const submitSearch = function () {
|
|||||||
.search-button:hover {
|
.search-button:hover {
|
||||||
background: var(--primary-color-l-1);
|
background: var(--primary-color-l-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-form {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user