feat: make renderIcon/icon prop consistent (#496)

This commit is contained in:
Eric Liu 2021-01-27 14:16:07 -08:00 committed by GitHub
commit 63ef51209d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 67 additions and 67 deletions

View file

@ -7,8 +7,8 @@
export let isOpen = false;
/**
* Specify the icon props
* @type {{ render: import("carbon-icons-svelte").CarbonIcon; skeleton: boolean; }}
* Specify the icon from `carbon-icons-svelte` to render
* @type {typeof import("carbon-icons-svelte").CarbonIcon}
*/
export let icon = undefined;
@ -31,9 +31,9 @@
import { createEventDispatcher } from "svelte";
import { slide } from "svelte/transition";
import Close20 from "carbon-icons-svelte/lib/Close20";
import AppSwitcher20 from "carbon-icons-svelte/lib/AppSwitcher20";
import { Icon } from "../../Icon";
import Close20 from "carbon-icons-svelte/lib/Close20/Close20.svelte";
import AppSwitcher20 from "carbon-icons-svelte/lib/AppSwitcher20/AppSwitcher20.svelte";
import Icon from "../../Icon/Icon.svelte";
const dispatch = createEventDispatcher();
@ -79,7 +79,7 @@
dispatch(isOpen ? 'open' : 'close');
}}"
>
<Icon render="{isOpen ? Close20 : AppSwitcher20}" {...icon} />
<Icon render="{icon || (isOpen ? Close20 : AppSwitcher20)}" />
<slot name="text">
{#if text}<span>{text}</span>{/if}
</slot>