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

Function getOrderedLibraries

packages/dev/s2-docs/src/searchUtils.tsx:480–489  ·  view source on GitHub ↗
(currentPage: Page)

Source from the content-addressed store, hash-verified

478}
479
480export function getOrderedLibraries(currentPage: Page) {
481 const allLibraries = (Object.keys(TAB_DEFS) as Library[]).map(id => ({id, ...TAB_DEFS[id]}));
482 const currentLibId = getLibraryFromPage(currentPage);
483 const currentIndex = allLibraries.findIndex(lib => lib.id === currentLibId);
484 if (currentIndex > 0) {
485 const currentLib = allLibraries.splice(currentIndex, 1)[0];
486 allLibraries.unshift(currentLib);
487 }
488 return allLibraries;
489}
490
491export function getResourceTags(library: Library): Tag[] {
492 if (library === 'react-spectrum') {

Callers 1

useSearchMenuStateFunction · 0.85

Calls 1

getLibraryFromPageFunction · 0.90

Tested by

no test coverage detected