mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 10:51: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>
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
export let href = undefined;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/** Obtain a reference to the HTML anchor element */
|
||||
export let ref = null;
|
||||
|
||||
import { Icon } from "../../Icon";
|
||||
import Icon from "../../Icon/Icon.svelte";
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
@ -39,5 +39,5 @@
|
|||
rel="{$$restProps.target === '_blank' ? 'noopener noreferrer' : undefined}"
|
||||
{...$$restProps}
|
||||
>
|
||||
<Icon {...icon} />
|
||||
<Icon render="{icon}" />
|
||||
</a>
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
export let text = undefined;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/** Obtain a reference to the HTML anchor element */
|
||||
export let ref = null;
|
||||
|
||||
import { Icon } from "../../Icon";
|
||||
import Icon from "../../Icon/Icon.svelte";
|
||||
</script>
|
||||
|
||||
<li class:bx--side-nav__item="{true}">
|
||||
|
@ -42,7 +42,7 @@
|
|||
class:bx--side-nav__icon="{true}"
|
||||
class:bx--side-nav__icon--small="{true}"
|
||||
>
|
||||
<Icon {...icon} />
|
||||
<Icon render="{icon}" />
|
||||
</div>
|
||||
{/if}
|
||||
<span class:bx--side-nav__link-text="{true}">{text}</span>
|
||||
|
|
|
@ -9,16 +9,16 @@
|
|||
export let text = undefined;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/** Obtain a reference to the HTML button element */
|
||||
export let ref = null;
|
||||
|
||||
import ChevronDown16 from "carbon-icons-svelte/lib/ChevronDown16";
|
||||
import { Icon } from "../../Icon";
|
||||
import ChevronDown16 from "carbon-icons-svelte/lib/ChevronDown16/ChevronDown16.svelte";
|
||||
import Icon from "../../Icon/Icon.svelte";
|
||||
</script>
|
||||
|
||||
<li class:bx--side-nav__item="{true}" class:bx--side-nav__item--icon="{icon}">
|
||||
|
@ -35,7 +35,7 @@
|
|||
>
|
||||
{#if icon}
|
||||
<div class:bx--side-nav__icon="{true}">
|
||||
<Icon {...icon} />
|
||||
<Icon render="{icon}" />
|
||||
</div>
|
||||
{/if}
|
||||
<span class:bx--side-nav__submenu-title="{true}">{text}</span>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue