]> git.ardis.lu - targz/commitdiff
Add basic loading/complete indicators
authorArdis Lu <ardisglu@gmail.com>
Sun, 5 May 2024 06:44:47 +0000 (23:44 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sun, 5 May 2024 06:44:47 +0000 (23:44 -0700)
index.html

index 640e044169a77744cd8e49d70e6c36285068bcec..45446199cc996fc5907969a31faeaecd22b3a827 100644 (file)
       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';
+        }
+      }
     }
   </style>
 </head>
       }).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', '');
     });
   </script>
 </body>
This page took 0.036901 seconds and 4 git commands to generate.