@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
tsx 42 lines 1.03 KB
Raw
1 import { useGT } from "gt-react";
2 import { LoaderCircleIcon } from "lucide-react";
3 import { cva, type VariantProps } from "class-variance-authority";
4 import { observeVisibleAnimation } from "~/lib/visibleAnimation";
5 import { cn } from "~/lib/utils";
6
7 // No default size: inside a Button the parent's svg rule sizes the glyph.
8 const spinnerVariants = cva("motion-safe:visible-animate-spin", {
9 variants: {
10 size: {
11 xs: "size-3",
12 sm: "size-3.5",
13 md: "size-4",
14 lg: "size-5",
15 },
16 tone: {
17 current: "",
18 muted: "text-muted-foreground",
19 },
20 },
21 defaultVariants: { tone: "current" },
22 });
23
24 function Spinner({
25 className,
26 size,
27 tone,
28 ...props
29 }: React.ComponentPropsWithoutRef<typeof LoaderCircleIcon> & VariantProps<typeof spinnerVariants>) {
30 const gt = useGT();
31 return (
32 <LoaderCircleIcon
33 aria-label={gt("Loading")}
34 ref={observeVisibleAnimation}
35 className={cn(spinnerVariants({ size, tone }), className)}
36 role="status"
37 {...props}
38 />
39 );
40 }
41
42 export { Spinner };