MCPcopy Create free account
hub / github.com/e2b-dev/surf / ChatLoader

Function ChatLoader

components/chat/loader.tsx:11–36  ·  view source on GitHub ↗
({
  text = "surfing",
  className,
  dotClassName,
  interval = 200,
}: ChatLoaderProps)

Source from the content-addressed store, hash-verified

9}
10
11export function ChatLoader({
12 text = "surfing",
13 className,
14 dotClassName,
15 interval = 200,
16}: ChatLoaderProps) {
17 const [dots, setDots] = useState(1);
18
19 useEffect(() => {
20 const timer = setInterval(() => {
21 setDots((prev) => (prev % 3) + 1);
22 }, interval);
23
24 return () => clearInterval(timer);
25 }, [interval]);
26
27 return (
28 <div className={cn("flex items-center font-mono text-xs", className)}>
29 <span>{text}</span>
30 <span className={cn("inline-flex ml-1", dotClassName)}>
31 {".".repeat(dots)}
32 <span className="invisible">{".".repeat(3 - dots)}</span>
33 </span>
34 </div>
35 );
36}

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected