From dccb31106a43f2c295da3f8a4225a44969cb3ef7 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 13 Jul 2025 18:52:35 -0700 Subject: [PATCH] feat: more spinners --- src/ui/LoadingAnimation.tsx | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/ui/LoadingAnimation.tsx b/src/ui/LoadingAnimation.tsx index e0747d12c..dc19f6da4 100644 --- a/src/ui/LoadingAnimation.tsx +++ b/src/ui/LoadingAnimation.tsx @@ -1,6 +1,37 @@ import { Text } from "ink"; import React, { useEffect, useState } from "react"; +const SPINNER_BARS = "▁▂▃▄▅▆▇█▇▆▅▄▃▁"; +const SPINNER_BLOCKS = "▉▊▋▌▍▎▏▎▍▌▋▊▉"; +const SPINNER_CORNERS = "▖▘▝▗"; +const SPINNER_CLASSIC = "-/|\\-/|"; +const SPINNER_BOX = "┤┘┴└├┌┬┐"; +const SPINNER_DOUBLE_BARS = [ + "▁▁", + "▁▂", + "▁▃", + "▁▄", + "▁▅", + "▁▆", + "▁▇", + "▁█", + "▂▇", + "▃▆", + "▄▅", + "▅▄", + "▆▃", + "▇▂", + "█▁", + "▇▁", + "▆▁", + "▅▁", + "▄▁", + "▃▁", + "▂▁", +]; + +const SPINNER: string | string[] = SPINNER_CORNERS; + interface LoadingAnimationProps { visible?: boolean; color?: string; @@ -8,10 +39,11 @@ interface LoadingAnimationProps { const LoadingAnimation: React.FC = ({ visible = true, - color = "gray", + color = "blue", }) => { const [currentIndex, setCurrentIndex] = useState(0); - const animationChars = ["-", "/", "|", "\\", "-", "/"]; + const animationChars = + typeof SPINNER === "string" ? (SPINNER as string).split("") : SPINNER; useEffect(() => { if (!visible) return;