This commit is contained in:
j3d1 2023-05-11 20:26:48 +02:00
parent 765a265e46
commit 6c65da0882
6 changed files with 95 additions and 11 deletions

View file

@ -6,14 +6,7 @@
<a class="sidebar-toggle d-flex" @click="toggleSidebar">
<i class="hamburger align-self-center"></i>
</a>
<form class="d-none d-sm-inline-block">
<div class="input-group input-group-navbar">
<input type="text" class="form-control" placeholder="Search…" aria-label="Search">
<button class="btn" type="button">
<b-icon-search class="bi-valign-middle"></b-icon-search>
</button>
</div>
</form>
<SearchBox/>
<div class="navbar-collapse collapse">
<ul class="navbar-nav navbar-align">
<Notifications :notifications="notifications"/>
@ -38,16 +31,17 @@ import Messages from "@/components/Messages.vue";
import Footer from "@/components/Footer.vue";
import Sidebar from "@/components/Sidebar.vue";
import UserDropdown from "@/components/UserDropdown.vue";
import SearchBox from "@/components/SearchBox.vue";
export default {
name: 'BaseLayout',
components: {
SearchBox,
UserDropdown,
Sidebar,
Footer,
Messages,
Notifications,
...BIcons
Notifications
},
props: {
hideSearch: {

View file

@ -82,7 +82,6 @@
</template>
<script>
import {mapGetters, mapMutations} from 'vuex';
import * as BIcons from "bootstrap-icons-vue";
export default {

View file

@ -0,0 +1,44 @@
<template>
<form class="d-none d-sm-inline-block">
<div class="input-group input-group-navbar">
<input type="text" class="form-control" placeholder="Search…" aria-label="Search" v-model="query" id="searchText">
<button class="btn" type="button" @click.prevent="search">
<b-icon-search class="bi-valign-middle"></b-icon-search>
</button>
</div>
</form>
</template>
<script>
import * as BIcons from "bootstrap-icons-vue";
export default {
name: "SearchBox",
components: {
...BIcons
},
data() {
return {
query: ""
}
},
methods: {
search() {
if(this.query.length > 0)
this.$router.push("/search/" + encodeURIComponent(this.query));
else
document.getElementById("searchText").focus();
}
},
mounted() {
console.log(this.$route)
console.log(this.$route.params.query)
this.query = decodeURIComponent(this.$route.params.query || encodeURIComponent(""));
}
}
</script>
<style scoped>
</style>

View file

@ -6,6 +6,8 @@
</a>
<a class="nav-link dropdown-toggle d-none d-sm-inline-block" href="#" @click="toggleDropdown">
<img src="/assets/img/avatars/avatar.png" class="avatar img-fluid rounded mr-1"
alt="Charles Hall"/>
<span class="text-dark">
{{ username }}
</span>

View file

@ -3,8 +3,11 @@ import Dashboard from '@/views/Dashboard.vue';
import Login from '@/views/Login.vue';
import Register from '@/views/Register.vue';
import store from '@/store';
import Profile from '@/views/Profile.vue';
import Settings from '@/views/Settings.vue';
import Friends from '@/views/Friends.vue';
import Inventory from '@/views/Inventory.vue';
import Search from '@/views/Search.vue';
import InventoryDetail from '@/views/InventoryDetail.vue';
import InventoryNew from '@/views/InventoryNew.vue';
import InventoryEdit from '@/views/InventoryEdit.vue';
@ -17,6 +20,7 @@ const routes = [
{path: '/inventory/:id/edit', component: InventoryEdit, meta: {requiresAuth: true}, props: true},
{path: '/inventory/new', component: InventoryNew, meta: {requiresAuth: true}},
{path: '/friends', component: Friends, meta: {requiresAuth: true}},
{path: '/search/:query', component: Search, meta: {requiresAuth: true}},
{path: '/login', component: Login, meta: {requiresAuth: false}},
{path: '/register', component: Register, meta: {requiresAuth: false}},
{path: '/:pathMatch(.*)*', redirect: '/'}

View file

@ -0,0 +1,41 @@
<template>
<BaseLayout>
<main class="content">
<div class="container-fluid p-0">
<h1 class="h3 mb-3">Blank Page</h1>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h5 class="card-title mb-0">Empty card</h5>
</div>
<div class="card-body">
<div class="logo">
<img src="/src/assets/icons/toolshed-48x48.png" alt="Toolshed logo">
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</BaseLayout>
</template>
<script>
import {mapGetters, mapMutations} from 'vuex';
import * as BIcons from "bootstrap-icons-vue";
import BaseLayout from "@/components/BaseLayout.vue";
export default {
name: 'Search',
components: {
...BIcons,
BaseLayout
},
}
</script>
<style scoped>
</style>