feat: add basic layout styles, add home link on the logo, add global loading indicator

This commit is contained in:
2024-04-20 23:17:29 +02:00
parent 6800f42b3f
commit efeee47588
3 changed files with 36 additions and 4 deletions

View File

@@ -1,10 +1,18 @@
import { Outlet } from "react-router-dom";
import { Link, Outlet } from "react-router-dom";
import { Spinner } from "./spinner";
import { useIsFetching } from "@tanstack/react-query";
export function Layout() {
const fetching = useIsFetching();
const isLoading = fetching > 0;
return (
<div>
<header>
<h1>Header</h1>
<div className={"p-6 mx-auto max-w-screen-lg"}>
<header className={"flex items-center justify-between"}>
<h1>
<Link to={"/"}>Podcaster</Link>
</h1>
{isLoading && <Spinner />}
</header>
<main>
<Outlet />

View File

@@ -0,0 +1,19 @@
.loader {
width: 24px;
height: 24px;
border: 3px solid #fff;
border-bottom-color: #ff3d00;
border-radius: 50%;
display: inline-block;
box-sizing: border-box;
animation: rotation 1s linear infinite;
}
@keyframes rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}

View File

@@ -0,0 +1,5 @@
import s from "./spinner.module.css";
export function Spinner() {
return <span className={s.loader} aria-busy={"true"}></span>;
}