Skip to content
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.

Commit

Permalink
feat(Icon): added support for svg
Browse files Browse the repository at this point in the history
  • Loading branch information
TheComputerM committed Aug 8, 2020
1 parent d251af2 commit 1e78f75
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/components/Icon/Icon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
let classes = '';
export let inactive = false;
export let size = '24px';
export let md = false;
export let path = null;
export let title = null;
export let rotate = '0deg';
export let style = '';
export { classes as class };
</script>
Expand All @@ -13,9 +15,22 @@

<i
aria-hidden="true"
style="font-size:{size};{style}"
style="font-size: {size};transform: rotate({rotate});{style}"
class="s-icon {classes}"
class:material-icons={md}
{title}
class:inactive>
{#if path}
<svg
xmlns="http://www.w3.org/2000/svg"
width={size}
height={size}
viewBox="0 0 24 24">
<path d={path}>
{#if title}
<title>{title}</title>
{/if}
</path>
</svg>
{/if}
<slot />
</i>
5 changes: 5 additions & 0 deletions src/components/Icon/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@
color: var(--theme-icons-inactive);
}
}

svg {
fill: currentColor;
transform: inherit;
}

0 comments on commit 1e78f75

Please sign in to comment.