Showing
1 changed file
with
31 additions
and
2 deletions
@@ -4,7 +4,9 @@ import SearchBar from "~/components/SearchBar.vue"; | @@ -4,7 +4,9 @@ import SearchBar from "~/components/SearchBar.vue"; | ||
4 | import { ref } from "vue"; | 4 | import { ref } from "vue"; |
5 | import { useTMDB } from "~/composables/tMDB"; | 5 | import { useTMDB } from "~/composables/tMDB"; |
6 | import { Movie } from "~/models/movie"; | 6 | import { Movie } from "~/models/movie"; |
7 | +import { FilmIcon } from "lucide-vue-next"; | ||
7 | import type { MovieInterface } from "~/interfaces/movie"; | 8 | import type { MovieInterface } from "~/interfaces/movie"; |
9 | +import { useDateFormat } from '@vueuse/core' | ||
8 | //#endregion | 10 | //#endregion |
9 | 11 | ||
10 | //#region --Declaration--. | 12 | //#region --Declaration--. |
@@ -61,9 +63,36 @@ onMounted(() => { | @@ -61,9 +63,36 @@ onMounted(() => { | ||
61 | <!-- Barre de recherche --> | 63 | <!-- Barre de recherche --> |
62 | <search-bar placeholder="Rechercher un film..." /> | 64 | <search-bar placeholder="Rechercher un film..." /> |
63 | <!-- Loading Skeleton --> | 65 | <!-- Loading Skeleton --> |
64 | - <skeleton-movies-loader :is-initial-loading="isInitialLoading" :skeleton-number="20" /> | 66 | + <skeleton-movies-loader v-if="isInitialLoading" :is-initial-loading="isInitialLoading" :skeleton-number="20" /> |
65 | <!-- Liste des films --> | 67 | <!-- Liste des films --> |
66 | - <!-- <pre>{{ movies }}</pre>--> | 68 | + <div v-else-if="movies.length > 0" class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6"> |
69 | + <div | ||
70 | + v-for="movie in movies" | ||
71 | + :key="movie.id" | ||
72 | + class="bg-gray-800 rounded-lg overflow-hidden shadow-lg transition-transform duration-300 hover:scale-105 cursor-pointer" | ||
73 | + > | ||
74 | + <div class="relative pb-[150%]"> | ||
75 | + <img | ||
76 | + v-if="movie.poster_path" | ||
77 | + :src="`https://image.tmdb.org/t/p/w500${movie.poster_path}`" | ||
78 | + :alt="movie.title" | ||
79 | + class="absolute inset-0 w-full h-full object-cover" | ||
80 | + > | ||
81 | + <div v-else class="absolute inset-0 w-full h-full bg-gray-700 flex items-center justify-center"> | ||
82 | + <FilmIcon :size="48" class="text-gray-500" /> | ||
83 | + </div> | ||
84 | + <div | ||
85 | + class="absolute top-2 right-2 bg-primary text-white rounded-full w-10 h-10 flex items-center justify-center font-bold" | ||
86 | + > | ||
87 | + {{ movie.vote_average.toFixed(1) }} | ||
88 | + </div> | ||
89 | + </div> | ||
90 | + <div class="p-4"> | ||
91 | + <h2 class="text-lg font-bold mb-1 line-clamp-1">{{ movie.title }}</h2> | ||
92 | + <p class="text-sm text-gray-400">{{ useDateFormat(movie.release_date, 'DD-MM-YYYY') }}</p> | ||
93 | + </div> | ||
94 | + </div> | ||
95 | + </div> | ||
67 | </section> | 96 | </section> |
68 | </template> | 97 | </template> |
69 | 98 |
-
Please register or login to post a comment