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
| 1 | import { RefreshCwIcon } from "lucide-react"; |
| 2 | import { cva, type VariantProps } from "class-variance-authority"; |
| 3 | |
| 4 | import { cn } from "~/lib/utils"; |
| 5 | import { observeVisibleAnimation } from "~/lib/visibleAnimation"; |
| 6 | |
| 7 | // No default size: inside a Button the parent's svg rule sizes the glyph. |
| 8 | const refreshIconVariants = cva("", { |
| 9 | variants: { |
| 10 | size: { |
| 11 | xs: "size-3", |
| 12 | sm: "size-3.5", |
| 13 | md: "size-4", |
| 14 | lg: "size-5", |
| 15 | }, |
| 16 | }, |
| 17 | }); |
| 18 | |
| 19 | export function RefreshIcon({ |
| 20 | refreshing = false, |
| 21 | className, |
| 22 | size, |
| 23 | ...props |
| 24 | }: React.ComponentPropsWithoutRef<typeof RefreshCwIcon> & |
| 25 | VariantProps<typeof refreshIconVariants> & { refreshing?: boolean }) { |
| 26 | return ( |
| 27 | <RefreshCwIcon |
| 28 | aria-hidden |
| 29 | ref={refreshing ? observeVisibleAnimation : undefined} |
| 30 | className={cn( |
| 31 | refreshIconVariants({ size }), |
| 32 | refreshing && "motion-safe:visible-animate-spin", |
| 33 | className, |
| 34 | )} |
| 35 | {...props} |
| 36 | /> |
| 37 | ); |
| 38 | } |