Skip to content

Full Toolkit for Next-Level Domain Analysis

Improve spinner ⏳

Felix Wotschofsky439cfe19bd55
diff --git a/components/ui/spinner.module.css b/components/ui/spinner.module.css
new file mode 100644
index 0000000..80637e1
--- /dev/null
+++ b/components/ui/spinner.module.css
@@ -0,0 +1,40 @@
+.circle {
+ transform-origin: center;
+ animation: spin 1s step-start infinite;
+}
+
+@keyframes spin {
+ 0% {
+ transform: rotate(0);
+ }
+ 10% {
+ transform: rotate(36deg);
+ }
+ 20% {
+ transform: rotate(72deg);
+ }
+ 30% {
+ transform: rotate(108deg);
+ }
+ 40% {
+ transform: rotate(144deg);
+ }
+ 50% {
+ transform: rotate(180deg);
+ }
+ 60% {
+ transform: rotate(216deg);
+ }
+ 70% {
+ transform: rotate(252deg);
+ }
+ 80% {
+ transform: rotate(288deg);
+ }
+ 90% {
+ transform: rotate(324deg);
+ }
+ 100% {
+ transform: rotate(360deg);
+ }
+}
diff --git a/components/ui/spinner.tsx b/components/ui/spinner.tsx
index 1a6aa4a..059b975 100644
--- a/components/ui/spinner.tsx
+++ b/components/ui/spinner.tsx
@@ -2,21 +2,121 @@ import * as React from 'react';
import { cn } from '@/lib/utils';
+import styles from './spinner.module.css';
+
const Spinner = React.forwardRef<
- HTMLTableElement,
+ HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
- className={cn(
- 'inline-block h-9 w-9 animate-[spin_0.8s_linear_infinite] rounded-full border-[2px] border-current border-t-transparent text-foreground',
- className,
- )}
+ className={cn('h-9 w-9', className)}
role="status"
aria-label="loading"
{...props}
>
<span className="sr-only">Loading...</span>
+
+ <svg
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg"
+ className="h-full w-full text-gray-900 dark:text-gray-400"
+ >
+ <g className={cn('origin-center', styles.circle)}>
+ <rect
+ x="11"
+ y="1"
+ width="2"
+ height="6"
+ opacity="1"
+ className="fill-current"
+ ></rect>
+ <rect
+ x="11"
+ y="1"
+ width="2"
+ height="6"
+ transform="rotate(36 12 12)"
+ opacity=".1"
+ className="fill-current"
+ ></rect>
+ <rect
+ x="11"
+ y="1"
+ width="2"
+ height="6"
+ transform="rotate(72 12 12)"
+ opacity=".2"
+ className="fill-current"
+ ></rect>
+ <rect
+ x="11"
+ y="1"
+ width="2"
+ height="6"
+ transform="rotate(108 12 12)"
+ opacity=".3"
+ className="fill-current"
+ ></rect>
+ <rect
+ x="11"
+ y="1"
+ width="2"
+ height="6"
+ transform="rotate(144 12 12)"
+ opacity=".4"
+ className="fill-current"
+ ></rect>
+ <rect
+ x="11"
+ y="1"
+ width="2"
+ height="6"
+ transform="rotate(180 12 12)"
+ opacity=".5"
+ className="fill-current"
+ ></rect>
+ <rect
+ x="11"
+ y="1"
+ width="2"
+ height="6"
+ transform="rotate(216 12 12)"
+ opacity=".6"
+ className="fill-current"
+ ></rect>
+ <rect
+ x="11"
+ y="1"
+ width="2"
+ height="6"
+ transform="rotate(252 12 12)"
+ opacity=".7"
+ className="fill-current"
+ ></rect>
+ <rect
+ x="11"
+ y="1"
+ width="2"
+ height="6"
+ transform="rotate(288 12 12)"
+ opacity=".8"
+ className="fill-current"
+ ></rect>
+ <rect
+ x="11"
+ y="1"
+ width="2"
+ height="6"
+ transform="rotate(324 12 12)"
+ opacity=".9"
+ className="fill-current"
+ ></rect>
+ </g>
+ </svg>
+ <span className="sr-only">Loading...</span>
</div>
));
Spinner.displayName = 'Spinner';