mirror of
https://github.com/cupcakearmy/nicco.io.git
synced 2025-09-06 02:30:45 +00:00
add discord and dynamic icons
This commit is contained in:
@@ -1,17 +1,37 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte'
|
||||
export let icon
|
||||
|
||||
$: src = `/icons/${icon}.svg`
|
||||
|
||||
let html = null
|
||||
|
||||
onMount(async () => {
|
||||
console.log(src)
|
||||
html = await fetch(src).then((res) => res.text())
|
||||
})
|
||||
</script>
|
||||
|
||||
<img {...$$restProps} src="/icons/{icon}.svg" alt={icon} />
|
||||
{#if html === null}
|
||||
<img {...$$restProps} {src} alt={icon} />
|
||||
{:else}
|
||||
<span {...$$restProps}>
|
||||
{@html html}
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
span,
|
||||
img {
|
||||
display: inline-block;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
contain: strict;
|
||||
fill: currentcolor;
|
||||
/* fill: currentcolor; */
|
||||
box-sizing: content-box;
|
||||
transform: translateY(0.2em);
|
||||
}
|
||||
span > :global(svg) {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
@@ -7,6 +7,11 @@
|
||||
{
|
||||
href: 'mailto:hi@nicco.io',
|
||||
name: 'Say hi@nicco.io',
|
||||
icon: 'mail-outline',
|
||||
},
|
||||
{
|
||||
href: 'https://discord.gg/wS7RpYTYd2',
|
||||
name: 'Chat on Discord',
|
||||
icon: 'chatbubbles-outline',
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user