MCPcopy Create free account
hub / github.com/arctic-cli/interface / ShimmerText

Function ShimmerText

packages/ui/src/components/shimmer-text.tsx:22–50  ·  view source on GitHub ↗
(props: { class?: string })

Source from the content-addressed store, hash-verified

20]
21
22export function ShimmerText(props: { class?: string }) {
23 const [index, setIndex] = createSignal(Math.floor(Math.random() * WORDS.length))
24
25 onMount(() => {
26 const interval = setInterval(() => {
27 setIndex(Math.floor(Math.random() * WORDS.length))
28 }, 4000)
29 onCleanup(() => clearInterval(interval))
30 })
31
32 const word = createMemo(() => WORDS[index()] + "...")
33 const chars = createMemo(() => word().split(""))
34
35 return (
36 <span data-component="shimmer-text" class={props.class}>
37 <span class="shimmer-bullet">● </span>
38 <For each={chars()}>
39 {(char, i) => (
40 <span
41 class="shimmer-char"
42 style={{ "--char-index": i() }}
43 >
44 {char}
45 </span>
46 )}
47 </For>
48 </span>
49 )
50}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected