Commit d81a50ca authored by Øyvind Julsrud's avatar Øyvind Julsrud Committed by Torstein
Browse files

DEICH-5925: deichman.no: added loading spinner

parent bfbff6b1
import { Block, Button, Icon, Input, Table } from "@digibib/deichman-ui";
import {
Block,
Button,
Icon,
Input,
Loader,
Table,
Text
} from "@digibib/deichman-ui";
import { useFormik } from "formik";
import { useRouter } from "next/router";
import React, { Fragment, useEffect, useState } from "react";
......@@ -8,6 +16,7 @@ import {
fetchChildPatrons
} from "../../store/adminSearch";
import { formatDateFromISOString } from "../../utilities/datetime";
import FullScreen from "../FullScreen";
import "./styles.css";
const initialValues = date => {
......@@ -113,6 +122,14 @@ const ChildPatronAdminSearch = () => {
router.push("/ansatt/ny-bruker");
};
if (isLoading) {
return (
<FullScreen>
<Loader />
</FullScreen>
);
}
return (
<div className="child-patron-admin-search">
<form onSubmit={handleSubmit} disabled={false}>
......@@ -150,8 +167,18 @@ const ChildPatronAdminSearch = () => {
</span>
</Block>
{!isLoading && (patrons?.length === 0 || !patrons) && (
<Block top={6}>
{!isLoading && patrons?.error && (
<Block top={4}>
<h3>
<Text error>
Søket <b>{formateDate(date)}</b> feilet.
</Text>
</h3>
</Block>
)}
{!isLoading && patrons?.length === 0 && (
<Block top={4}>
<h3>
Søket <b>{formateDate(date)}</b> gav ingen treff.
</h3>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment