import { Index, createMemo } from "solid-js" import { AnimatedCountLabel } from "./tool-count-label" export type CountItem = { key: string count: number one: string other: string } export function AnimatedCountList(props: { items: CountItem[]; fallback?: string; class?: string }) { const visible = createMemo(() => props.items.filter((item) => item.count > 0)) const fallback = createMemo(() => props.fallback ?? "") const showEmpty = createMemo(() => visible().length === 0 && fallback().length > 0) return ( {fallback()} {(item, index) => { const active = createMemo(() => item().count > 0) const hasPrev = createMemo(() => { for (let i = index - 1; i >= 0; i--) { if (props.items[i].count > 0) return true } return false }) return ( <> , ) }} ) }