From add1e3c99791f04873133ef246fd90b2442af86e Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Sat, 4 May 2024 23:44:47 -0700 Subject: [PATCH] Add basic loading/complete indicators --- index.html | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 640e044..4544619 100644 --- a/index.html +++ b/index.html @@ -47,12 +47,34 @@ border: 1px solid hsl(216deg 75% 75%); cursor: pointer; transition: background-color 400ms; + position: relative; &:hover, &:focus { transition: background-color 200ms; background-color: hsl(216deg 70% 85%); } + + &::after { + position: absolute; + line-height: 0; + inset-inline-start: calc(100% + 8px); + inset-block-start: 50%; + } + + &[data-loading] { + &::after { + content: '⏳'; + content: '⏳' / 'Loading'; + } + } + + &[data-complete] { + &::after { + content: '✅'; + content: '✅' / 'Complete'; + } + } } @@ -134,10 +156,14 @@ }).then(h => h.createWritable()); // Stream to destination file + e.submitter.removeAttribute('data-complete'); + e.submitter.setAttribute('data-loading', ''); const files = e.target.elements['contents'].files; - tar(files) + await tar(files) .pipeThrough(new CompressionStream('gzip')) .pipeTo(destination); + e.submitter.removeAttribute('data-loading'); + e.submitter.setAttribute('data-complete', ''); }); -- 2.47.3