Componentes para items de NavBar

This commit is contained in:
Alejandro Tasistro 2025-06-20 01:05:44 -03:00
parent bb27698e80
commit 2356fe597a
2 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,30 @@
<script>
import { mapMutations, mapState } from "vuex";
export default {
name: "Burger",
computed: {
...mapState('ui', ["burger_activa"])
},
methods: {
...mapMutations('ui', ["toggleBurger"]),
}
}
</script>
<template>
<a role="button"
class="navbar-burger"
:class="{'is-active': burger_activa}"
aria-label="menu"
aria-expanded="false"
data-target="nav-bar"
@click="toggleBurger">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</template>
<style scoped>
</style>

View file

@ -0,0 +1,42 @@
<script>
import { mapActions, mapMutations } from "vuex";
export default {
name: "Buscador",
methods: {
...mapActions('productos', ["filtrarProductos"]),
...mapMutations('ui', ["addMiga", "popUltimaBusqueda", "toggleBurger"]),
buscar() {
if (this.burger_activa)
this.toggleBurger();
this.filtrarProductos({ filtro: "nombre", valor: this.searchString });
this.popUltimaBusqueda();
this.addMiga({ nombre: this.searchString });
}
},
data() {
return {
searchString: "",
}
},
}
</script>
<template>
<div class="navbar-item field has-addons mt-1 mr-3 mb-1">
<a class="button is-small has-text-dark-grey" @click.capture="buscar">
<span class="icon">
<i class="fas fa-search"></i>
</span>
</a>
<input class="input is-small"
type="text"
placeholder="Harina"
v-model="searchString"
@keyup.enter="buscar">
</div>
</template>
<style scoped>
</style>