Rework to include "spinner" icon for loading state and dark mode
support.
This commit is contained in:
parent
bd59a73859
commit
32a7c08d95
3 changed files with 39 additions and 3 deletions
|
|
@ -61,7 +61,7 @@ const meta = `{
|
|||
<Content />
|
||||
</div>
|
||||
<dialog data-scripture=""
|
||||
class="p-0 bg-white rounded-sm w-full max-w-md m-auto flex-col flex hidden scripture">
|
||||
class="p-0 rounded-sm w-full max-w-md m-auto flex-col flex hidden scripture">
|
||||
<div tabindex="-1" autofocus class="p-4">
|
||||
<button data-close="">
|
||||
<span class="align-middle">close</span>
|
||||
|
|
@ -70,6 +70,11 @@ const meta = `{
|
|||
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
|
||||
</svg>
|
||||
</button>
|
||||
<div class="spinner">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-book-fill hidden" viewBox="0 0 16 16">
|
||||
<path d="M8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783"/>
|
||||
</svg>
|
||||
</div>
|
||||
<article class="mt-6">
|
||||
</article>
|
||||
<nav>
|
||||
|
|
|
|||
|
|
@ -120,12 +120,15 @@ footer {
|
|||
}
|
||||
|
||||
dialog.scripture {
|
||||
@apply bg-white;
|
||||
@apply dark:bg-gray-600 dark:text-neutral-300;
|
||||
p {
|
||||
@apply mt-4;
|
||||
span.verse {
|
||||
padding-left: 0.1rem;
|
||||
padding-right: 0.2rem;
|
||||
@apply align-super text-gray-500 text-sm;
|
||||
@apply dark:text-neutral-400;
|
||||
}
|
||||
span.poem-1 {
|
||||
}
|
||||
|
|
@ -147,12 +150,14 @@ dialog.scripture {
|
|||
}
|
||||
button[data-close] {
|
||||
@apply absolute top-0 right-0 pr-2 pb-2 pt-2 text-sm text-gray-500 cursor-pointer hover:text-red-900;
|
||||
@apply dark:text-gray-400 dark:hover:text-red-500;
|
||||
span {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
h1 {
|
||||
@apply font-bold mb-2 text-2xl;
|
||||
@apply dark:text-neutral-300;
|
||||
}
|
||||
nav {
|
||||
@apply mt-8;
|
||||
|
|
@ -160,6 +165,17 @@ dialog.scripture {
|
|||
@apply bottom-0 right-0 text-sm text-blue-400 pr-4 pb-4;
|
||||
}
|
||||
}
|
||||
.spinner {
|
||||
@apply justify-center flex items-center;
|
||||
}
|
||||
.spinner svg {
|
||||
@apply mt-12 text-sunday-theme;
|
||||
@apply dark:text-gray-300;
|
||||
transform: scale(2);
|
||||
animation-duration: 3s;
|
||||
animation-name: spinner-expand;
|
||||
animation-iteration-count: infinite;
|
||||
}
|
||||
}
|
||||
|
||||
#notes-list {
|
||||
|
|
@ -373,6 +389,18 @@ article#notes-page {
|
|||
}
|
||||
}
|
||||
|
||||
@keyframes spinner-expand {
|
||||
0% {
|
||||
transform: scale(2);
|
||||
}
|
||||
50% {
|
||||
transform: scale(4);
|
||||
}
|
||||
100% {
|
||||
transform: scale(2);
|
||||
}
|
||||
}
|
||||
|
||||
nav#pagination {
|
||||
@apply flex items-center justify-center mt-6 mb-6 text-xl transition-colors duration-500;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,21 +179,24 @@ export const bindModals = () => {
|
|||
dialog[0]?.showModal();
|
||||
dialog[0]?.setAttribute('data-scripture', scripture);
|
||||
dialog[0]?.classList.remove("hidden");
|
||||
//document.body.classList.add("overflow-hidden");
|
||||
dialog[0]?.querySelector('.spinner svg')
|
||||
.classList.remove('hidden');
|
||||
|
||||
fetch(uri)
|
||||
.then((response) => {
|
||||
console.log(response.ok);
|
||||
return response.json();
|
||||
})
|
||||
.then((response) => {
|
||||
render(dialog[0], response, refs);
|
||||
dialog[0]?.querySelector('.spinner svg')
|
||||
.classList.add('hidden');
|
||||
});
|
||||
});
|
||||
});
|
||||
dialog[0]?.addEventListener('click', (evt) => {
|
||||
if (evt.target === dialog[0]) {
|
||||
dialog[0]?.close();
|
||||
dialog[0]?.classList.add('hidden');
|
||||
dialog[0]?.querySelector('article')?.replaceChildren();
|
||||
dialog[0]?.querySelector('a.bg span').replaceChildren();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue