MCPcopy Create free account
hub / github.com/adobe/react-spectrum / AIIconItem

Function AIIconItem

packages/dev/s2-docs/src/AIIconSearchView.tsx:145–196  ·  view source on GitHub ↗
({
  item,
  isCopied = false
}: {
  item: (typeof aiIconList)[number];
  isCopied?: boolean;
})

Source from the content-addressed store, hash-verified

143});
144
145function AIIconItem({
146 item,
147 isCopied = false
148}: {
149 item: (typeof aiIconList)[number];
150 isCopied?: boolean;
151}) {
152 let ref = useRef(null);
153 // oxlint-disable react/react-compiler
154 return (
155 <ListBoxItem
156 id={item.id}
157 value={item}
158 textValue={item.id}
159 className={itemStyle}
160 ref={ref}
161 style={pressScale(ref)}>
162 {({isHovered, isFocusVisible}) =>
163 isCopied ? (
164 <>
165 <CheckmarkCircle styles={iconStyle({size: 'XL'})} />
166 <div
167 className={style({
168 maxWidth: '100%',
169 textOverflow: 'ellipsis',
170 overflow: 'hidden',
171 whiteSpace: 'nowrap'
172 })}>
173 Copied!
174 </div>
175 </>
176 ) : (
177 <>
178 {/* Only animate the tile under the pointer or keyboard focus, so the grid isn't
179 looping dozens of pixel animations simultaneously. */}
180 <PixelLoader icon={item.cells} isPlaying={isHovered || isFocusVisible} />
181 <div
182 className={style({
183 maxWidth: '100%',
184 textOverflow: 'ellipsis',
185 overflow: 'hidden',
186 whiteSpace: 'nowrap'
187 })}>
188 {item.id}
189 </div>
190 </>
191 )
192 }
193 </ListBoxItem>
194 );
195 // oxlint-enable react/react-compiler
196}
197
198interface AIIconListBoxProps {
199 items: typeof aiIconList;

Callers

nothing calls this directly

Calls 2

pressScaleFunction · 0.90
iconStyleFunction · 0.90

Tested by

no test coverage detected