@studiocms/ui
Version:
The UI library for StudioCMS. Includes the layouts & components we use to build StudioCMS.
14 lines (13 loc) • 476 B
JavaScript
function loadProgressBars() {
const allBars = document.querySelectorAll(".sui-progress");
for (const bar of allBars) {
const value = bar.dataset.value;
const max = bar.dataset.max;
const progress = bar.firstElementChild;
if (value && max) {
const percent = Math.round(Number.parseInt(value, 10) / Number.parseInt(max, 10) * 100);
progress.style.width = `${percent}%`;
}
}
}
document.addEventListener("astro:page-load", loadProgressBars);