Skip to content

Commit

Permalink
[icons][docs] Index search synchronously (#44001)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored Oct 6, 2024
1 parent 05b3aea commit 860ccd0
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions docs/data/material/components/material-icons/SearchIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,25 +522,21 @@ const allIconsMap = {};
const allIcons = Object.keys(mui)
.sort()
.map((importName) => {
let theme;
if (importName.includes('Outlined')) {
theme = 'Outlined';
} else if (importName.includes('TwoTone')) {
theme = 'Two tone';
} else if (importName.includes('Rounded')) {
theme = 'Rounded';
} else if (importName.includes('Sharp')) {
theme = 'Sharp';
} else {
theme = 'Filled';
let theme = 'Filled';
let name = importName;

for (const currentTheme of ['Outlined', 'Rounded', 'TwoTone', 'Sharp']) {
if (importName.endsWith(currentTheme)) {
theme = currentTheme === 'TwoTone' ? 'Two tone' : currentTheme;
name = importName.slice(0, -currentTheme.length);
break;
}
}

const name = importName.replace(/(Outlined|TwoTone|Rounded|Sharp)$/, '');
let searchable = name;
if (synonyms[searchable]) {
searchable += ` ${synonyms[searchable]}`;
}
searchIndex.addAsync(importName, searchable);
searchIndex.add(importName, searchable);

const icon = {
importName,
Expand Down

0 comments on commit 860ccd0

Please sign in to comment.