1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 18:26:38 -04:00

add loading spinner to /projects

This commit is contained in:
2021-07-31 10:15:33 -04:00
parent 053e5922c6
commit b273bdbf99
7 changed files with 60 additions and 34 deletions

View File

@ -7,6 +7,7 @@ import twemoji from "twemoji";
// don't continue if there isn't a span#meta-hits element on this page
const wrapper = document.getElementById("github-cards");
const spinner = document.getElementById("loading-spinner");
if (wrapper) {
dayjs.extend(relativeTime); // https://day.js.org/docs/en/plugin/relative-time
@ -76,7 +77,12 @@ if (wrapper) {
wrapper.appendChild(div);
});
// these elements were added after the first twemoji parsing
// we're done, hide the loading spinner
if (spinner) {
spinner.style.display = "none";
}
// the repo descriptions were added after the first twemoji parsing
twemoji.parse(wrapper, {
callback: (icon) => `/assets/emoji/${icon}.svg`,
});