diff --git a/src/components/layout.tsx b/src/components/layout.tsx index a8ebe41..34876c4 100644 --- a/src/components/layout.tsx +++ b/src/components/layout.tsx @@ -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 ( -
-
-

Header

+
+
+

+ Podcaster +

+ {isLoading && }
diff --git a/src/components/spinner.module.css b/src/components/spinner.module.css new file mode 100644 index 0000000..8438a39 --- /dev/null +++ b/src/components/spinner.module.css @@ -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); + } +} diff --git a/src/components/spinner.tsx b/src/components/spinner.tsx new file mode 100644 index 0000000..6c4ff96 --- /dev/null +++ b/src/components/spinner.tsx @@ -0,0 +1,5 @@ +import s from "./spinner.module.css"; + +export function Spinner() { + return ; +}