Bruno Predot

Ajout props placeholder pour searchBar componant.

1 <script setup lang="ts"> 1 <script setup lang="ts">
2 - 2 +import SearchBar from "~/components/SearchBar.vue";
3 </script> 3 </script>
4 4
5 <template> 5 <template>
6 <section> 6 <section>
7 <h1 class="text-4xl font-bold mb-8 text-center">Découvrez les films populaires</h1> 7 <h1 class="text-4xl font-bold mb-8 text-center">Découvrez les films populaires</h1>
  8 + <!-- Barre de recherche -->
  9 + <search-bar placeholder="Rechercher un film..."/>
8 </section> 10 </section>
9 </template> 11 </template>
10 12
@@ -8,6 +8,17 @@ import { ref } from "vue"; @@ -8,6 +8,17 @@ import { ref } from "vue";
8 // const emit = defineEmits([]); 8 // const emit = defineEmits([]);
9 //#endregion 9 //#endregion
10 10
  11 +//#region --Props--.
  12 +const props = defineProps({
  13 + placeholder: {
  14 + type: String,
  15 + required: true,
  16 + nullable: false,
  17 + default: ''
  18 + }
  19 +})
  20 +//#endregion
  21 +
11 //#region --Data/refs--. 22 //#region --Data/refs--.
12 const searchQuery = ref(""); 23 const searchQuery = ref("");
13 //#endregion 24 //#endregion
@@ -20,7 +31,7 @@ const searchQuery = ref(""); @@ -20,7 +31,7 @@ const searchQuery = ref("");
20 <input 31 <input
21 v-model="searchQuery" 32 v-model="searchQuery"
22 type="text" 33 type="text"
23 - placeholder="Rechercher un film..." 34 + :placeholder="placeholder"
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" 35 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')" 36 @input="console.log('debouncedSearch à prévoir')"
26 /> 37 />