mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
parent
9c83fbda69
commit
5ae12066fb
18 changed files with 193 additions and 88 deletions
40
src/components/Icon/Icon.svelte
Normal file
40
src/components/Icon/Icon.svelte
Normal file
|
@ -0,0 +1,40 @@
|
|||
<script>
|
||||
let className = undefined;
|
||||
export { className as class };
|
||||
export let skeleton = false;
|
||||
export let render = undefined;
|
||||
export let title = undefined;
|
||||
export let tabindex = undefined;
|
||||
export let focusable = false;
|
||||
export let style = undefined;
|
||||
|
||||
import IconSkeleton from './Icon.Skeleton.svelte';
|
||||
|
||||
const iconName = render.toString().split(' ')[1];
|
||||
const size = parseInt(iconName.slice(-2), 10);
|
||||
</script>
|
||||
|
||||
{#if skeleton}
|
||||
<IconSkeleton
|
||||
on:click
|
||||
on:mouseover
|
||||
on:mouseenter
|
||||
on:mouseleave
|
||||
{size}
|
||||
class={className}
|
||||
{style} />
|
||||
{:else}
|
||||
<svelte:component
|
||||
this={render}
|
||||
on:click
|
||||
on:mouseover
|
||||
on:mouseenter
|
||||
on:mouseleave
|
||||
aria-label={$$props['aria-label']}
|
||||
aria-labelledby={$$props['aria-labelledby']}
|
||||
class={className}
|
||||
{tabindex}
|
||||
{focusable}
|
||||
{style}
|
||||
{title} />
|
||||
{/if}
|
Loading…
Add table
Add a link
Reference in a new issue