first commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
.loading {
|
||||
position: fixed;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
bottom: 0px;
|
||||
background-color: var(--loading-background);
|
||||
background-image: url("/loading.gif");
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-size: 100px 100px;
|
||||
z-index: 100000;
|
||||
}
|
||||
|
||||
.loadingVisible {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.loadingHidden {
|
||||
display: none;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
"use client";
|
||||
import classNames from "classnames";
|
||||
import { useEffect, useState } from "react";
|
||||
import { EVENT_TYPES, useEventHandlerStore } from "@store/EventHandler.Store";
|
||||
import style from "./Loading.module.css";
|
||||
export default function Loading() {
|
||||
const eventHandler = useEventHandlerStore();
|
||||
const [classesNames, setClassesNames] = useState(
|
||||
classNames(style.loading, style.loadingHidden)
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
switch (eventHandler.eventType) {
|
||||
case EVENT_TYPES.SAVE:
|
||||
setClassesNames(classNames(style.loading, style.loadingVisible));
|
||||
break;
|
||||
case EVENT_TYPES.FILTER:
|
||||
setClassesNames(classNames(style.loading, style.loadingVisible));
|
||||
break;
|
||||
case EVENT_TYPES.LOADING:
|
||||
setClassesNames(classNames(style.loading, style.loadingVisible));
|
||||
break;
|
||||
default:
|
||||
setClassesNames(classNames(style.loading, style.loadingHidden));
|
||||
break;
|
||||
}
|
||||
}, [eventHandler.eventType]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={classesNames}> </div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user