diff --git a/ui/src/components/EventList.tsx b/ui/src/components/EventList.tsx
index 5592aea..40afa32 100644
--- a/ui/src/components/EventList.tsx
+++ b/ui/src/components/EventList.tsx
@@ -1,5 +1,6 @@
import { Event } from '../props/generated';
import EventCard from '../organisms/EventCard';
+import { Transition } from '@headlessui/react';
interface EventListProps {
events: Event[]
@@ -7,23 +8,41 @@ interface EventListProps {
}
export default function EventList({ events, loading }: EventListProps) {
+
+ const numberOfSkeleton = () => {
+ return 6 - (events?.length % 6)
+ }
+
return (
- {loading
- ? (
- <>
-
-
-
-
-
-
- >
- )
- : (events !== null ? events.map((event) => ()) : null)
- }
+ {events?.length > 0 ? events.map((event) => (
+ 0}
+ enter="transform transition duration-[400ms]"
+ enterFrom="opacity-0 rotate-[-120deg] scale-50"
+ enterTo="opacity-100 rotate-0 scale-100"
+ leave="transform duration-200 transition ease-in-out"
+ leaveFrom="opacity-100 rotate-0 scale-100 "
+ leaveTo="opacity-0 scale-95 "
+ >
+
+
+ )) : null}
+ {Array(numberOfSkeleton()).fill(0).map((_) => (
+
+
+
+ ))}
diff --git a/ui/src/pages/Lending.tsx b/ui/src/pages/Lending.tsx
index b84b5a0..3ff580f 100644
--- a/ui/src/pages/Lending.tsx
+++ b/ui/src/pages/Lending.tsx
@@ -24,18 +24,23 @@ export default function Lending({ Events, User, MainTag, Tags, Cities }: Props)
});
const onFilterChange = async (f: Filters) => {
- setLoading(true)
+ setLoading(true);
setFilters(f);
+ setEvents([]);
const e = await requestEvents(0, f);
- setLoading(false)
+ setLoading(false);
setPage(0);
setEvents(e);
}
const onRequestNewPage = async () => {
+ setLoading(true);
const e = await requestEvents(page + 1, filters);
- setPage(page + 1);
- setEvents(events.concat(e));
+ if (e.length > 0) {
+ setPage(page + 1);
+ setEvents(events.concat(e));
+ }
+ setLoading(false);
}
return (
@@ -43,7 +48,7 @@ export default function Lending({ Events, User, MainTag, Tags, Cities }: Props)