Skip to content

Commit

Permalink
[icons] Try sync index addition
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Oct 5, 2024
1 parent 842e4e7 commit 5637c55
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/data/material/components/material-icons/SearchIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,29 +518,31 @@ const searchIndex = new FlexSearchIndex({
tokenize: 'full',
});

const nameCleanRegex = /(Outlined|TwoTone|Rounded|Sharp)$/;

const allIconsMap = {};
const allIcons = Object.keys(mui)
.sort()
.map((importName) => {
let theme;
if (importName.includes('Outlined')) {
if (importName.endsWith('Outlined')) {
theme = 'Outlined';
} else if (importName.includes('TwoTone')) {
} else if (importName.endsWith('TwoTone')) {
theme = 'Two tone';
} else if (importName.includes('Rounded')) {
} else if (importName.endsWith('Rounded')) {
theme = 'Rounded';
} else if (importName.includes('Sharp')) {
} else if (importName.endsWith('Sharp')) {
theme = 'Sharp';
} else {
theme = 'Filled';
}

const name = importName.replace(/(Outlined|TwoTone|Rounded|Sharp)$/, '');
const name = importName.replace(nameCleanRegex, '');
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 5637c55

Please sign in to comment.