Skip to content

Commit

Permalink
Rename design picker filter category labels (#97224)
Browse files Browse the repository at this point in the history
  • Loading branch information
madhusudhand authored Dec 9, 2024
1 parent 3336b37 commit c939a2c
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions packages/design-picker/src/components/unified-design-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ const DesignPicker: React.FC< DesignPickerProps > = ( {
} ) => {
const hasCategories = !! Object.keys( categorization?.categories || {} ).length;
const filteredDesigns = useFilteredDesigns( designs, categorization );
const featureCategories = useMemo(
const categoryTypes = useMemo(
() => ( categorization?.categories || [] ).filter( ( { slug } ) => isFeatureCategory( slug ) ),
[ categorization?.categories ]
);
const subjectCategories = useMemo(
const categoryTopics = useMemo(
() =>
( categorization?.categories || [] ).filter( ( { slug } ) => ! isFeatureCategory( slug ) ),
[ categorization?.categories ]
Expand All @@ -248,26 +248,23 @@ const DesignPicker: React.FC< DesignPickerProps > = ( {
return (
<div>
<div className="design-picker__filters">
{ categorization && featureCategories.length && isMultiFilterEnabled && (
<DesignPickerFilterGroup title={ translate( 'Features' ) }>
{ categorization && categoryTypes.length && isMultiFilterEnabled && (
<DesignPickerFilterGroup title={ translate( 'Type' ) }>
<DesignPickerCategoryFilter
className="design-picker__category-filter"
categories={ featureCategories }
categories={ categoryTypes }
onSelect={ categorization.onSelect }
selectedSlugs={ categorization.selections }
isMultiSelection={ isMultiFilterEnabled }
forceSwipe
/>
</DesignPickerFilterGroup>
) }
{ categorization && subjectCategories.length && (
<DesignPickerFilterGroup
title={ isMultiFilterEnabled ? translate( 'Subjects' ) : '' }
grow
>
{ categorization && categoryTopics.length && (
<DesignPickerFilterGroup title={ isMultiFilterEnabled ? translate( 'Topic' ) : '' } grow>
<DesignPickerCategoryFilter
className="design-picker__category-filter"
categories={ isMultiFilterEnabled ? subjectCategories : categorization.categories }
categories={ isMultiFilterEnabled ? categoryTopics : categorization.categories }
onSelect={ categorization.onSelect }
selectedSlugs={ categorization.selections }
isMultiSelection={ isMultiFilterEnabled }
Expand Down

0 comments on commit c939a2c

Please sign in to comment.