2022-07-27 23:16:50 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import feather from 'feather-icons';
|
2022-07-28 00:05:54 +00:00
|
|
|
export const directions: string[] = ['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'];
|
2022-07-27 23:16:50 +00:00
|
|
|
|
|
|
|
|
export let name: string;
|
2022-07-28 00:05:54 +00:00
|
|
|
export let direction: string = 'n';
|
2022-07-27 23:16:50 +00:00
|
|
|
export let strokeWidth: string | number;
|
|
|
|
|
export let stroke: string | number;
|
2022-07-28 00:05:54 +00:00
|
|
|
export let width: string = '1em';
|
|
|
|
|
export let height: string = '1em';
|
2022-07-27 23:16:50 +00:00
|
|
|
|
|
|
|
|
$: icon = feather.icons[name];
|
|
|
|
|
$: rotation = directions.indexOf(direction) * 45;
|
|
|
|
|
$: if (icon) {
|
2022-07-28 00:05:54 +00:00
|
|
|
if (stroke) icon.attrs['stroke'] = stroke;
|
|
|
|
|
if (strokeWidth) icon.attrs['stroke-width'] = strokeWidth;
|
2022-07-27 23:16:50 +00:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
{#if icon}
|
2022-07-28 00:05:54 +00:00
|
|
|
<svg {...icon.attrs} style="width: {width}; height: {height}; transform: rotate({rotation}deg);">
|
2022-07-27 23:16:50 +00:00
|
|
|
<g>
|
|
|
|
|
{@html icon.contents}
|
|
|
|
|
</g>
|
|
|
|
|
</svg>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
svg {
|
|
|
|
|
width: 1em;
|
|
|
|
|
height: 1em;
|
|
|
|
|
overflow: visible;
|
|
|
|
|
transform-origin: 50% 50%;
|
|
|
|
|
}
|
2022-07-28 00:05:54 +00:00
|
|
|
</style>
|