Spinner
The agnostic-astro package utilizes XElement under-the-hood in order to provide build-time Astro components. These build-time components will help your project get closer to realizing a mostly no client-side runtime…if you do it right, this should mean an all-green 100% Lighthouse performance score! Leverage the benefits of Islands architecture by sending mostly server built agnostic-astro components. Then, sprinkle client-hydrated ones only as needed.
Usage
AgnosticUI requires the import of the common.min.css
from your Astro base layout:
import 'agnostic-css/public/css-dist/common.min.css';
Then you can import Astro Spinner component:
import AgSpinner from 'agnostic-astro/Spinner.astro';
Here's the agnostic-astro Spinner component in use:
...
<AgSpinner showOnMount size="small" />
<AgSpinner showOnMount />
<AgSpinner showOnMount size="large" />
<AgSpinner showOnMount size="xlarge" />
<div class="mbs24 text-center">In 5 seconds a customized spinner will be shown below…</span>
<AgSpinner class="manuallyShow mbs40" showOnMount={false} size="xlarge" style="--agnostic-spinner-color: salmon;" />
...and so on
<script>
setTimeout(() => {
// aria-busy toggles spinner's visibility. By default showOnMount is true but
// in this case, we've set: showOnMount={false} allowing control via JavaScript
document.querySelector('.manuallyShow').setAttribute('aria-busy', 'true');
}, 5000);
</script>
In 5 seconds a customized spinner will be shown below…