techfolio-nexus / components /loading-spinner.js
bsateeshk's picture
Create a personal porfolio web site for an IT professional. It should use latest tech stack, responsive, use tailwind or other good icons, supports accessibility.
3e93c1d verified
Raw History Blame Contribute Delete
1.18 kB
// Loading Spinner Web Component
class LoadingSpinner extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
const size = this.getAttribute('size') || '40';
const color = this.getAttribute('color') || '#f59e0b';
this.shadowRoot.innerHTML = `
<style>
:host {
display: inline-block;
}
.spinner {
animation: rotate 2s linear infinite;
width: ${size}px;
height: ${size}px;
}
.circle {
stroke: ${color};
stroke-width: 3;
stroke-linecap: round;
animation: dash 1.5s ease-in-out infinite;
fill: none;
}
@keyframes rotate {
100% { transform: rotate(360deg); }
}
@keyframes dash {
0% {
stroke-dasharray: 1,