fix: fallback to defaultIcon when value is undefined (#7294)
Some checks are pending
CI / build (push) Waiting to run
CI / svelte-check (push) Blocked by required conditions
CI / formatting (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / uitest (push) Waiting to run
CI / uitest-pg (push) Waiting to run
CI / uitest-qms (push) Waiting to run
CI / docker-build (push) Blocked by required conditions
CI / dist-build (push) Blocked by required conditions

Signed-off-by: Dakshesh Jain <dakshesh.jain14@gmail.com>
This commit is contained in:
Dakshesh Jain 2024-12-08 01:10:59 +05:30 committed by GitHub
parent c100f427f3
commit 6b3ec81f63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,7 +20,7 @@
import { ComponentType } from 'svelte'
export let value: IconProps
export let value: IconProps | undefined
export let size: IconSize
export let iconWithEmoji: AnySvelteComponent | Asset | ComponentType | undefined = view.ids.IconWithEmoji
export let defaultIcon: AnySvelteComponent | Asset | ComponentType = document.icon.Document
@ -28,10 +28,10 @@
<Icon
{size}
icon={value.icon === iconWithEmoji && iconWithEmoji ? IconWithEmoji : value.icon ?? defaultIcon}
iconProps={value.icon === iconWithEmoji && iconWithEmoji
? { icon: value.color }
icon={value?.icon === iconWithEmoji && iconWithEmoji ? IconWithEmoji : value?.icon ?? defaultIcon}
iconProps={value?.icon === iconWithEmoji && iconWithEmoji
? { icon: value?.color }
: {
fill: value.color !== undefined ? getPlatformColorDef(value.color, $themeStore.dark).icon : 'currentColor'
fill: value?.color !== undefined ? getPlatformColorDef(value?.color, $themeStore.dark).icon : 'currentColor'
}}
/>