| 99 | } |
| 100 | |
| 101 | function IconListBox({items, copiedId, onAction, listBoxClassName}: IconListBoxProps) { |
| 102 | return ( |
| 103 | <Virtualizer |
| 104 | layout={GridLayout} |
| 105 | layoutOptions={{ |
| 106 | minItemSize: new Size(64, 64), |
| 107 | maxItemSize: new Size(64, 64), |
| 108 | minSpace: new Size(12, 12), |
| 109 | preserveAspectRatio: true |
| 110 | }}> |
| 111 | <ListBox |
| 112 | onAction={item => onAction(item.toString())} |
| 113 | items={items} |
| 114 | layout="grid" |
| 115 | className={listBoxClassName || style({width: '100%', scrollPaddingY: 4, padding: 8})} |
| 116 | dependencies={[copiedId]} |
| 117 | renderEmptyState={() => ( |
| 118 | <IllustratedMessage styles={style({marginX: 'auto', marginY: 32})}> |
| 119 | <NoSearchResults /> |
| 120 | <Heading>No results</Heading> |
| 121 | <Content>Try a different search term.</Content> |
| 122 | </IllustratedMessage> |
| 123 | )}> |
| 124 | {item => <IconItem item={item} isCopied={copiedId === item.id} />} |
| 125 | </ListBox> |
| 126 | </Virtualizer> |
| 127 | ); |
| 128 | } |
| 129 | |
| 130 | const itemStyle = style({ |
| 131 | ...focusRing(), |