Skip to content

Commit

Permalink
fix(IconLibrary): hide ai icon from icon library search (carbon-desig…
Browse files Browse the repository at this point in the history
…n-system#4190)

* fix(IconCategory): hide AI icon

* refactor(PictogramCategory): refactor pictogram excludes to match logic for icons
  • Loading branch information
emyarod authored Aug 13, 2024
1 parent 733851f commit d3003cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
20 changes: 12 additions & 8 deletions src/components/SVGLibraries/IconLibrary/IconCategory.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@ import {

const IconCategory = ({ category, icons, columnCount }) => {
const [subCategoryRef, containerIsVisible] = useIntersectionObserver();
const hiddenIcons = ['AI'];

return (
<section className={svgCategory}>
<h2 className={cx(h2, categoryTitle)}>{category}</h2>
<ul ref={subCategoryRef}>
<ul className={svgGrid}>
{icons.map((icon, i) => (
<SvgCard
isLastCard={(i + 1) % columnCount === 0}
containerIsVisible={containerIsVisible}
key={icon.name}
icon={icon}
/>
))}
{icons
.filter((icon) => !hiddenIcons.includes(icon.name))
.map((icon, i) => (
<SvgCard
isLastCard={(i + 1) % columnCount === 0}
containerIsVisible={containerIsVisible}
key={icon.name}
icon={icon}
/>
))}
</ul>
</ul>
</section>
Expand Down
18 changes: 7 additions & 11 deletions src/components/SVGLibraries/PictogramLibrary/PictogramCategory.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,19 @@ import {

const IconCategory = ({ category, pictograms, columnCount }) => {
const [sectionRef, containerIsVisible] = useIntersectionObserver();
const hiddenPictograms = [
'ibm--z',
'ibm--z--partition',
'ibm--z-and-linuxone-multi-frame',
'ibm--z-and-linuxone-single-frame',
];

return (
<section ref={sectionRef} className={svgCategory}>
<h2 className={cx(h2, categoryTitle)}>{category}</h2>
<ul className={cx(svgGrid, pictogramList)}>
{pictograms
.filter((pictogram) => {
if (
pictogram.name === 'ibm--z' ||
pictogram.name === 'ibm--z--partition' ||
pictogram.name === 'ibm--z-and-linuxone-multi-frame' ||
pictogram.name === 'ibm--z-and-linuxone-single-frame'
) {
return false;
}
return true;
})
.filter((pictogram) => !hiddenPictograms.includes(pictogram.name))
.map((pictogram, i) => (
<SvgCard
isLastCard={(i + 1) % columnCount === 0}
Expand Down

0 comments on commit d3003cc

Please sign in to comment.