From 70f79c6b7f39d5431e7527f4ddbc910f8ec17c37 Mon Sep 17 00:00:00 2001 From: jecaro Date: Sat, 23 Sep 2023 15:39:34 +0200 Subject: [PATCH] show a spinner during lengthy operations --- frontend/src/Browse.hs | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/frontend/src/Browse.hs b/frontend/src/Browse.hs index 4d5bf4a..f441af5 100644 --- a/frontend/src/Browse.hs +++ b/frontend/src/Browse.hs @@ -185,4 +185,34 @@ contentWidget MkConfig {..} path = do StOther code -> elAttr "article" ("class" =: "prose") $ el "pre" . el "code" . text $ code - _ -> blank + _ -> spinner + +spinner :: DomBuilder t m => m () +spinner = + elAttr + "div" + ( "class" + =: T.unwords + [ "absolute", + "right-1/2", + "bottom-1/2", + "transform", + "translate-x-1/2", + "translate-y-1/2" + ] + ) + $ elAttr + "div" + ( "class" + =: T.unwords + [ "border-t-transparent", + "border-solid", + "animate-spin", + "rounded-full", + "border-blue-400", + "border-4", + "h-8", + "w-8" + ] + ) + blank