mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
feat: make renderIcon/icon prop consistent (#496)
This commit is contained in:
parent
f2a3f8d2e1
commit
63ef51209d
13 changed files with 67 additions and 67 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue