From f78619090ce45336282dd219d66429a828064729 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sat, 6 May 2023 19:58:46 -0700 Subject: [PATCH] Disable button and show spinner while loading --- index.html | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index b920de3..0b70cf7 100644 --- a/index.html +++ b/index.html @@ -60,11 +60,17 @@ background: hsl(216deg 50% 95%); border: 1px solid hsl(216deg 70% 50%); border-radius: 4px; + margin-inline-end: 8px; cursor: pointer; transition: filter 600ms; } - :is(input, output, button):is(:hover, :focus-within) { + button:disabled { + cursor: not-allowed; + border: 1px solid hsl(216deg 70% 75%); + } + + :is(input, output, button:not(:disabled)):is(:hover, :focus-within) { filter: drop-shadow(0 0 2px hsl(216deg 70% 50%)); transition: filter 200ms; } @@ -88,6 +94,24 @@ white-space: nowrap; border-width: 0; } + + @keyframes spin { + 100% { + transform: rotate(360deg); + } + } + + .inline-spinner { + display: inline-block; + box-sizing: border-box; + block-size: 1em; + inline-size: 1em; + border: 0.25em solid transparent; + border-block-start: 0.25em solid black; + border-radius: 50%; + animation: spin 1s infinite; + visibility: hidden; + } @@ -109,7 +133,10 @@ - +
+ + +
@@ -119,6 +146,9 @@ -- 2.47.3