Skip to content

Instantly share code, notes, and snippets.

@ever-dev
Last active March 5, 2021 22:00
Show Gist options
  • Save ever-dev/d60bb3a5fecec33be297fbd68393ed6d to your computer and use it in GitHub Desktop.
Save ever-dev/d60bb3a5fecec33be297fbd68393ed6d to your computer and use it in GitHub Desktop.
Gear loading spinner React & TailwindCSS
import "./styles.less";
export default function LoadingScreen() {
return (
<div className="tw-w-screen tw-h-screen tw-flex tw-items-center tw-justify-center">
<div className="loading tw-relative">
<div className="gear one">
<svg id="blue" viewBox="0 0 100 100" fill="#94DDFF">
<path d="M97.6,55.7V44.3l-13.6-2.9c-0.8-3.3-2.1-6.4-3.9-9.3l7.6-11.7l-8-8L67.9,20c-2.9-1.7-6-3.1-9.3-3.9L55.7,2.4H44.3l-2.9,13.6c-3.3,0.8-6.4,2.1-9.3,3.9l-11.7-7.6l-8,8L20,32.1c-1.7,2.9-3.1,6-3.9,9.3L2.4,44.3v11.4l13.6,2.9c0.8,3.3,2.1,6.4,3.9,9.3l-7.6,11.7l8,8L32.1,80c2.9,1.7,6,3.1,9.3,3.9l2.9,13.6h11.4l2.9-13.6c3.3-0.8,6.4-2.1,9.3-3.9l11.7,7.6l8-8L80,67.9c1.7-2.9,3.1-6,3.9-9.3L97.6,55.7z M50,65.6c-8.7,0-15.6-7-15.6-15.6s7-15.6,15.6-15.6s15.6,7,15.6,15.6S58.7,65.6,50,65.6z" />
</svg>
</div>
<div className="gear two">
<svg id="pink" viewBox="0 0 100 100" fill="#FB8BB9">
<path d="M97.6,55.7V44.3l-13.6-2.9c-0.8-3.3-2.1-6.4-3.9-9.3l7.6-11.7l-8-8L67.9,20c-2.9-1.7-6-3.1-9.3-3.9L55.7,2.4H44.3l-2.9,13.6c-3.3,0.8-6.4,2.1-9.3,3.9l-11.7-7.6l-8,8L20,32.1c-1.7,2.9-3.1,6-3.9,9.3L2.4,44.3v11.4l13.6,2.9c0.8,3.3,2.1,6.4,3.9,9.3l-7.6,11.7l8,8L32.1,80c2.9,1.7,6,3.1,9.3,3.9l2.9,13.6h11.4l2.9-13.6c3.3-0.8,6.4-2.1,9.3-3.9l11.7,7.6l8-8L80,67.9c1.7-2.9,3.1-6,3.9-9.3L97.6,55.7z M50,65.6c-8.7,0-15.6-7-15.6-15.6s7-15.6,15.6-15.6s15.6,7,15.6,15.6S58.7,65.6,50,65.6z" />
</svg>
</div>
<div className="gear three">
<svg id="yellow" viewBox="0 0 100 100" fill="#FFCD5C">
<path d="M97.6,55.7V44.3l-13.6-2.9c-0.8-3.3-2.1-6.4-3.9-9.3l7.6-11.7l-8-8L67.9,20c-2.9-1.7-6-3.1-9.3-3.9L55.7,2.4H44.3l-2.9,13.6c-3.3,0.8-6.4,2.1-9.3,3.9l-11.7-7.6l-8,8L20,32.1c-1.7,2.9-3.1,6-3.9,9.3L2.4,44.3v11.4l13.6,2.9c0.8,3.3,2.1,6.4,3.9,9.3l-7.6,11.7l8,8L32.1,80c2.9,1.7,6,3.1,9.3,3.9l2.9,13.6h11.4l2.9-13.6c3.3-0.8,6.4-2.1,9.3-3.9l11.7,7.6l8-8L80,67.9c1.7-2.9,3.1-6,3.9-9.3L97.6,55.7z M50,65.6c-8.7,0-15.6-7-15.6-15.6s7-15.6,15.6-15.6s15.6,7,15.6,15.6S58.7,65.6,50,65.6z" />
</svg>
</div>
<div className="lil-circle tw-flex tw-items-center tw-justify-center">
<svg className="blur-circle">
<filter id="blur">
<feGaussianBlur in="SourceGraphic" stdDeviation="13" />
</filter>
<circle
cx="70"
cy="70"
r="66"
fill="transparent"
stroke="white"
strokeWidth="40"
filter="url(#blur)"
/>
</svg>
</div>
</div>
</div>
);
}
.gear {
position: absolute;
z-index: -10;
width: 40px;
height: 40px;
animation: spin 5s infinite;
}
.two {
left: 40px;
width: 80px;
height: 80px;
animation: spin-reverse 5s infinite;
}
.three {
top: 45px;
left: -10px;
width: 60px;
height: 60px;
}
@keyframes spin {
50% {
transform: rotate(360deg);
}
}
@keyframes spin-reverse {
50% {
transform: rotate(-360deg);
}
}
.lil-circle {
position: absolute;
border-radius: 50%;
box-shadow: inset 0 0 10px 2px gray, 0 0 50px white;
width: 100px;
height: 100px;
opacity: 0.65;
}
.blur-circle {
position: absolute;
top: -19px;
left: -19px;
}
.text {
color: lightgray;
text-align: center;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment