diff --git a/src/components/ui/loading/loading.module.css b/src/components/ui/loading/loading.module.css
new file mode 100644
index 0000000..b12ba9f
--- /dev/null
+++ b/src/components/ui/loading/loading.module.css
@@ -0,0 +1,25 @@
+.wrapper {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+
+ width: 100%;
+ min-height: 200px;
+}
+
+.spinner {
+ width: 48px;
+ height: 48px;
+
+ border: 5px solid #e0e0e0;
+ border-top: 5px solid #3498db;
+
+ border-radius: 50%;
+ animation: spin 0.8s linear infinite;
+}
+
+@keyframes spin {
+ to {
+ transform: rotate(360deg);
+ }
+}
\ No newline at end of file
diff --git a/src/components/ui/loading/loading.tsx b/src/components/ui/loading/loading.tsx
new file mode 100644
index 0000000..536cc99
--- /dev/null
+++ b/src/components/ui/loading/loading.tsx
@@ -0,0 +1,12 @@
+import React from "react";
+import styles from "./loading.module.css";
+
+const Loading: React.FC = () => {
+ return (
+
+ );
+};
+
+export default Loading;
\ No newline at end of file
diff --git a/src/pages/Volunteers/VolunteersPage.tsx b/src/pages/Volunteers/VolunteersPage.tsx
index 869d6a5..ae43fbc 100644
--- a/src/pages/Volunteers/VolunteersPage.tsx
+++ b/src/pages/Volunteers/VolunteersPage.tsx
@@ -6,6 +6,7 @@ import ToolBar from "../../components/ToolBar/ToolBar";
import filter from "../../utils/filter";
import getUserById from "../../utils/users/getUserById";
import User from "./interfaces/user.interface";
+import Loading from "../../components/ui/loading/loading";
interface Filters {
alphabetical: "asc" | "desc";
@@ -57,6 +58,7 @@ const VolunteerPage: React.FC = () => {
fetchUsers();
}, []);
+ if(loading) return ;
return (
@@ -67,13 +69,9 @@ const VolunteerPage: React.FC = () => {
/>
- {loading ? (
-
Chargement des bénévoles…
- ) : (
- filter(users, filters, "user").map((user: User) => (
+ {filter(users, filters, "user").map((user: User) => (
- ))
- )}
+ ))}
diff --git a/src/stories/Loading.stories.jsx b/src/stories/Loading.stories.jsx
new file mode 100644
index 0000000..6986aa8
--- /dev/null
+++ b/src/stories/Loading.stories.jsx
@@ -0,0 +1,13 @@
+import Loading from "../components/ui/loading/loading.tsx";
+
+
+export default {
+ title: 'UI/Loading',
+ component: Loading,
+ parameters: {
+ layout: 'centered',
+ },
+ tags: ['autodocs'],
+};
+
+export const Primary = {};
\ No newline at end of file