Skip to content

Commit 0d02ab9

Browse files
authored
fix: Search icon styleguide using prefixed string (#1300)
Changes from searching the kebab case icon name to the component name. Also strip spaces and dashes before searching, so kebab case search still works.
1 parent 87315a7 commit 0d02ab9

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/code-studio/src/styleguide/Icons.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ function Icons(): React.ReactElement {
7070
const renderIcons = Object.values(dh)
7171
.filter((icon: IconDefinition): boolean => {
7272
const matchesFilter =
73-
(icon.prefix.toLowerCase() + icon.iconName.toLowerCase()).indexOf(
74-
search.toLowerCase()
75-
) !== -1;
73+
getPrefixedName(icon.iconName, icon.prefix)
74+
.toLowerCase()
75+
.indexOf(
76+
search.replace(/\s/g, '').replace(/-/g, '').toLowerCase()
77+
) !== -1;
7678
const isDH = dhFilter && (icon.prefix as string) === DH_PREFIX;
7779
const isVS = vsFilter && (icon.prefix as string) === VS_PREFIX;
7880
return matchesFilter && (isDH || isVS);

0 commit comments

Comments
 (0)