@local-civics/hub-ui 0.1.178 → 0.1.180

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5588,13 +5588,25 @@ const PathwayCard = (props) => {
5588
5588
  },
5589
5589
  [props.criteria]
5590
5590
  );
5591
+ const categoryIdByLabel = React__namespace.useMemo(
5592
+ () => {
5593
+ var _a2;
5594
+ return Object.entries((_a2 = props.categoryNames) != null ? _a2 : {}).reduce((acc, [id, label]) => {
5595
+ acc[label] = id;
5596
+ return acc;
5597
+ }, {});
5598
+ },
5599
+ [props.categoryNames]
5600
+ );
5591
5601
  const [activeFilters, setActiveFilters] = React__namespace.useState(
5592
5602
  () => /* @__PURE__ */ new Set()
5593
5603
  );
5594
5604
  const filteredBadges = activeFilters.size === 0 ? badges : badges.filter(
5595
5605
  (b) => {
5596
5606
  var _a2;
5597
- return (_a2 = b.categories) == null ? void 0 : _a2.some((c) => activeFilters.has(c));
5607
+ return (_a2 = b.categories) == null ? void 0 : _a2.some(
5608
+ (categoryId) => activeFilters.has(categoryId)
5609
+ );
5598
5610
  }
5599
5611
  );
5600
5612
  const filterClassName = "inline-block px-4 py-2 bg-gray-600 text-white rounded-full cursor-pointer text-sm";
@@ -5635,7 +5647,10 @@ const PathwayCard = (props) => {
5635
5647
  "div",
5636
5648
  {
5637
5649
  key: id,
5638
- onClick: () => toggleFilter(id),
5650
+ onClick: () => {
5651
+ var _a3;
5652
+ return toggleFilter((_a3 = categoryIdByLabel[label]) != null ? _a3 : id);
5653
+ },
5639
5654
  className: isActive ? `${filterClassName} bg-gray-700` : "inline-block px-4 py-2 rounded-full hover:bg-gray-200 cursor-pointer text-sm"
5640
5655
  },
5641
5656
  label