Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Bruno Predot
/
tmdb_test
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Bruno Predot
2025-04-24 14:24:55 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7d675c513def7424c4aa6b5909567848e3a51650
7d675c51
1 parent
a14cf180
Chargement des premiers film au mounted du composant.
Formattage.
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
38 deletions
app.vue
components/MoviesList.vue
components/SearchBar.vue
components/SkeletonMoviesLoader.vue
pages/index.vue
app.vue
View file @
7d675c5
<script setup lang="ts">
</script>
<script lang="ts" setup></script>
<template>
<v-locale-provider>
...
...
@@ -12,6 +10,4 @@
</v-locale-provider>
</template>
<style scoped>
</style>
\ No newline at end of file
<style scoped></style>
...
...
components/MoviesList.vue
View file @
7d675c5
<script
setup lang="ts"
>
<script
lang="ts" setup
>
//#region --import--.
import SearchBar from "~/components/SearchBar.vue";
import { ref } from "vue";
...
...
@@ -54,7 +54,13 @@ const fetchMovies = async (page: number) => {
isLoadingMore.value = false;
}
};
fetchMovies(1)
//#endregion
//#region --Global event--.
onMounted(() => {
// Chargement des premiers films.
fetchMovies(1);
});
//#endregion
</script>
...
...
@@ -62,14 +68,12 @@ fetchMovies(1)
<section>
<h1 class="text-4xl font-bold mb-8 text-center">Découvrez les films populaires</h1>
<!-- Barre de recherche -->
<search-bar placeholder="Rechercher un film..."/>
<search-bar placeholder="Rechercher un film..."
/>
<!-- Loading Skeleton -->
<skeleton-movies-loader :is-initial-loading="isInitialLoading" :skeleton-number="20" />
<!-- Liste des films -->
<!-- <pre>{{ movies }}</pre>-->
<!-- <pre>{{ movies }}</pre>-->
</section>
</template>
<style scoped>
</style>
\ No newline at end of file
<style scoped></style>
...
...
components/SearchBar.vue
View file @
7d675c5
<script
setup lang="ts"
>
<script
lang="ts" setup
>
//#region --import--.
import { SearchIcon, XIcon } from "lucide-vue-next";
import { ref } from "vue";
...
...
@@ -14,8 +14,8 @@ defineProps({
type: String,
required: false,
nullable: false,
default:
''
}
default:
"",
}
,
});
//#endregion
...
...
@@ -30,11 +30,11 @@ const searchQuery = ref("");
<div class="relative max-w-xl mx-auto">
<input
v-model="searchQuery"
type="text"
:placeholder="placeholder"
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"
type="text"
@input="console.log('debouncedSearch à prévoir')"
>
/
>
<button
v-if="searchQuery"
class="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-white"
...
...
@@ -49,6 +49,4 @@ const searchQuery = ref("");
</section>
</template>
<style scoped>
</style>
\ No newline at end of file
<style scoped></style>
\ No newline at end of file
...
...
components/SkeletonMoviesLoader.vue
View file @
7d675c5
<script
setup lang="ts"
>
<script
lang="ts" setup
>
//#region --Props--.
defineProps({
isInitialLoading: {
...
...
@@ -10,26 +10,23 @@ defineProps({
type: Number,
required: false,
nullable: false,
default: 12
}
default: 12
,
}
,
});
//#endregion
</script>
<template>
<!-- Skeleton loader pendant le chargement initial -->
<section v-if="isInitialLoading" class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
<div v-for="i in skeletonNumber" :key="i" class="bg-gray-800 rounded-lg overflow-hidden shadow-lg animate-pulse">
<div class="h-80 bg-gray-700"/>
<div class="h-80 bg-gray-700"
/>
<div class="p-4">
<div class="h-6 bg-gray-700 rounded mb-3"/>
<div class="h-4 bg-gray-700 rounded w-2/3"/>
<div class="h-6 bg-gray-700 rounded mb-3"
/>
<div class="h-4 bg-gray-700 rounded w-2/3"
/>
</div>
</div>
</section>
</template>
<style scoped>
</style>
\ No newline at end of file
<style scoped></style>
\ No newline at end of file
...
...
pages/index.vue
View file @
7d675c5
<script setup lang="ts">
</script>
<script lang="ts" setup></script>
<template>
<v-container class="mx-auto px-4 py-8">
<movies-list/>
<movies-list
/>
</v-container>
</template>
<style scoped>
</style>
\ No newline at end of file
<style scoped></style>
...
...
Please
register
or
login
to post a comment