Showing
2 changed files
with
44 additions
and
0 deletions
| @@ -3,3 +3,4 @@ | @@ -3,3 +3,4 @@ | ||
| 3 | - Ajout page index. | 3 | - Ajout page index. |
| 4 | - Modification app.vue afin d'initialiser l'app avec vuetify et NuxtPage pour démarrer sur la page index. | 4 | - Modification app.vue afin d'initialiser l'app avec vuetify et NuxtPage pour démarrer sur la page index. |
| 5 | - Création du composant MoviesList. | 5 | - Création du composant MoviesList. |
| 6 | +- Création du composant SearchBar. |
components/SearchBar.vue
0 → 100644
| 1 | +<script setup lang="ts"> | ||
| 2 | +//#region --import--. | ||
| 3 | +import { SearchIcon, XIcon } from "lucide-vue-next"; | ||
| 4 | +import { ref } from "vue"; | ||
| 5 | +//#endregion | ||
| 6 | + | ||
| 7 | +//#region --Emits--. | ||
| 8 | +// const emit = defineEmits([]); | ||
| 9 | +//#endregion | ||
| 10 | + | ||
| 11 | +//#region --Data/refs--. | ||
| 12 | +const searchQuery = ref(""); | ||
| 13 | +//#endregion | ||
| 14 | +</script> | ||
| 15 | + | ||
| 16 | +<template> | ||
| 17 | + <!-- Barre de recherche --> | ||
| 18 | + <section class="mb-8"> | ||
| 19 | + <div class="relative max-w-xl mx-auto"> | ||
| 20 | + <input | ||
| 21 | + v-model="searchQuery" | ||
| 22 | + type="text" | ||
| 23 | + placeholder="Rechercher un film..." | ||
| 24 | + class="w-full px-4 py-3 bg-gray-800 rounded-full text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary" | ||
| 25 | + @input="console.log('debouncedSearch à prévoir')" | ||
| 26 | + /> | ||
| 27 | + <button | ||
| 28 | + v-if="searchQuery" | ||
| 29 | + class="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-white" | ||
| 30 | + @click="console.log('clearSearch à prévoir')" | ||
| 31 | + > | ||
| 32 | + <XIcon :size="20" /> | ||
| 33 | + </button> | ||
| 34 | + <button v-else class="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400"> | ||
| 35 | + <SearchIcon :size="20" /> | ||
| 36 | + </button> | ||
| 37 | + </div> | ||
| 38 | + </section> | ||
| 39 | +</template> | ||
| 40 | + | ||
| 41 | +<style scoped> | ||
| 42 | + | ||
| 43 | +</style> |
-
Please register or login to post a comment