Function
EntityList
({
items,
renderItem,
getKey,
emptyView,
className,
}: EntityListProps<T>)
Source from the content-addressed store, hash-verified
| 249 | }; |
| 250 | |
| 251 | export function EntityList<T>({ |
| 252 | items, |
| 253 | renderItem, |
| 254 | getKey, |
| 255 | emptyView, |
| 256 | className, |
| 257 | }: EntityListProps<T>) { |
| 258 | if (items.length === 0 && emptyView) { |
| 259 | return ( |
| 260 | <div className="flex-1 flex justify-center items-center"> |
| 261 | <div className="max-w-sm mx-auto">{emptyView}</div> |
| 262 | </div> |
| 263 | ); |
| 264 | } |
| 265 | |
| 266 | return ( |
| 267 | <div className={cn( |
| 268 | "flex flex-col gap-y-4", |
| 269 | className, |
| 270 | )}> |
| 271 | {items.map((item, index) => ( |
| 272 | <div key={getKey ? getKey(item, index) : index}> |
| 273 | {renderItem(item, index)} |
| 274 | </div> |
| 275 | ))} |
| 276 | </div> |
| 277 | ); |
| 278 | }; |
| 279 | |
| 280 | interface EntityItemProps { |
| 281 | href: string; |
Callers
nothing calls this directly
Tested by
no test coverage detected