| 203 | } |
| 204 | |
| 205 | function AIIconListBox({items, copiedId, onAction, listBoxClassName}: AIIconListBoxProps) { |
| 206 | return ( |
| 207 | <Virtualizer |
| 208 | layout={GridLayout} |
| 209 | layoutOptions={{ |
| 210 | minItemSize: new Size(64, 64), |
| 211 | maxItemSize: new Size(64, 64), |
| 212 | minSpace: new Size(12, 12), |
| 213 | preserveAspectRatio: true |
| 214 | }}> |
| 215 | <ListBox |
| 216 | onAction={item => onAction(item.toString())} |
| 217 | items={items} |
| 218 | layout="grid" |
| 219 | className={listBoxClassName || style({width: '100%', scrollPaddingY: 4, padding: 8})} |
| 220 | dependencies={[copiedId]} |
| 221 | renderEmptyState={() => ( |
| 222 | <IllustratedMessage styles={style({marginX: 'auto', marginY: 32})}> |
| 223 | <NoSearchResults /> |
| 224 | <Heading>No results</Heading> |
| 225 | <Content>Try a different search term.</Content> |
| 226 | </IllustratedMessage> |
| 227 | )}> |
| 228 | {item => <AIIconItem item={item} isCopied={copiedId === item.id} />} |
| 229 | </ListBox> |
| 230 | </Virtualizer> |
| 231 | ); |
| 232 | } |
| 233 | |
| 234 | export function AIIconsPageSearch() { |
| 235 | let {copiedId, handleCopyImport} = useCopyAIImport(); |