refactor: centralize styling system usage

This commit is contained in:
thePR0M3TH3AN committed 2025-10-12 16:31:13 -04:00
1 parent 0df93ba204
commit 92794d47dc
15 files changed
+395 -80

No files matched your search

+10 -2
View File
@@ -2,6 +2,10 @@
import { createModalAccessibility } from "./modalAccessibility.js";
import { Nip71FormManager } from "./nip71FormManager.js";
import {
applyDynamicStyles,
removeDynamicStyles,
} from "../styleSystem.js";
export class UploadModal {
constructor({
@@ -761,7 +765,7 @@ export class UploadModal {
if (!Number.isFinite(fraction) || fraction < 0) {
this.cloudflareProgressBar.classList.add("hidden");
this.cloudflareProgressBar.setAttribute("aria-hidden", "true");
this.cloudflareProgressFill.style.width = "0%";
removeDynamicStyles(this.cloudflareProgressFill, { slot: "r2-progress" });
this.cloudflareProgressFill.setAttribute("aria-valuenow", "0");
this.emit("upload:r2-progress", { fraction: null });
return;
@@ -772,7 +776,11 @@ export class UploadModal {
this.cloudflareProgressBar.classList.remove("hidden");
this.cloudflareProgressBar.setAttribute("aria-hidden", "false");
this.cloudflareProgressFill.style.width = `${percent}%`;
applyDynamicStyles(
this.cloudflareProgressFill,
{ "--cloudflare-progress-width": `${percent}%` },
{ slot: "r2-progress" },
);
this.cloudflareProgressFill.setAttribute("aria-valuenow", `${percent}`);
this.emit("upload:r2-progress", { fraction: clamped });
}