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

Function loadIllustrations

packages/dev/s2-docs/src/IllustrationCards.tsx:263–281  ·  view source on GitHub ↗
(variant: string, style: string)

Source from the content-addressed store, hash-verified

261const cache = new Map();
262
263function loadIllustrations(variant: string, style: string): Promise<IllustrationItemType[]> {
264 let key = variant === 'gradient' ? `${variant}:${style}` : variant;
265 if (cache.has(key)) {
266 return cache.get(key);
267 }
268
269 let promise: Promise<IllustrationItemType[]>;
270 if (variant === 'linear') {
271 promise = import('./illustrations/linear').then(m => m.default);
272 } else {
273 promise =
274 style === 'generic1'
275 ? import('./illustrations/generic1').then(m => m.default)
276 : import('./illustrations/generic2').then(m => m.default);
277 }
278
279 cache.set(key, promise);
280 return promise;
281}

Callers 1

IllustrationListFunction · 0.85

Calls 2

hasMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected