From 97baf4fd8d0ee00b1b858a1be149aba3505dc469 Mon Sep 17 00:00:00 2001 From: Mike Wilkerson <11575183+mlwilkerson@users.noreply.github.com> Date: Wed, 22 May 2024 09:28:43 -0700 Subject: [PATCH] include kit and kit-duotone on family drop down only when present in the kit --- .../fa-icon-chooser/fa-icon-chooser.tsx | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/fa-icon-chooser/src/components/fa-icon-chooser/fa-icon-chooser.tsx b/packages/fa-icon-chooser/src/components/fa-icon-chooser/fa-icon-chooser.tsx index e156723..e6f4079 100644 --- a/packages/fa-icon-chooser/src/components/fa-icon-chooser/fa-icon-chooser.tsx +++ b/packages/fa-icon-chooser/src/components/fa-icon-chooser/fa-icon-chooser.tsx @@ -7,7 +7,7 @@ import { Prop, State } from "@stencil/core"; -import { debounce, get, set, size } from "lodash"; +import { debounce, find, get, set, size } from "lodash"; import { buildIconChooserResult, CONSOLE_MESSAGE_PREFIX, @@ -306,10 +306,25 @@ export class FaIconChooser { const kit = get(response, "data.me.kit"); this.kitMetadata = kit; this.updateFamilyStyles(get(kit, "release.familyStyles", [])); - this.updateFamilyStyles([ - {family: 'kit', style: 'custom', prefix: 'fak'}, - {family: 'kit-duotone', style: 'custom', prefix: 'fakd'}, - ]); + + const kitFamilyStyles = [] + const iconUploads = get(response, "data.me.kit.iconUploads", []) + + if (find(iconUploads, (i) => i.pathData.length === 1)) { + kitFamilyStyles.push( + {family: 'kit', style: 'custom', prefix: 'fak'} + ) + } + + if (find(iconUploads, (i) => i.pathData.length > 1)) { + kitFamilyStyles.push( + {family: 'kit-duotone', style: 'custom', prefix: 'fakd'}, + ) + } + + if(kitFamilyStyles.length > 0) { + this.updateFamilyStyles(kitFamilyStyles); + } } updateFamilyStyles(familyStyles: Array) {