add closeIcon attribute to HeaderAction

This commit is contained in:
Daniel Miedzik 2021-10-15 18:20:25 +02:00
commit fc9e8a6926
5 changed files with 29 additions and 2 deletions

View file

@ -12,6 +12,12 @@
*/
export let icon = AppSwitcher20;
/**
* Specify the close icon from `carbon-icons-svelte` to render
* @type {typeof import("carbon-icons-svelte").CarbonIcon}
*/
export let closeIcon = Close20;
/**
* Specify the text
* Alternatively, use the named slot "text" (e.g., <div slot="text">...</div>)
@ -63,7 +69,8 @@
dispatch(isOpen ? 'open' : 'close');
}}"
>
<Icon render="{icon}" />
<Icon render="{icon}" style="{isOpen ? 'display: none' : ''}" />
<Icon render="{closeIcon}" style="{!isOpen ? 'display: none' : ''}" />
<slot name="text">
{#if text}<span>{text}</span>{/if}
</slot>