Skip to content

Commit

Permalink
fix: random emojis are fixed in dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
szattila98 committed Mar 31, 2024
1 parent 528ca87 commit ef49417
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/lib/components/RandomEmoji.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,24 @@
$: emoji = emojis[Math.floor(Math.random() * emojis.length)];
</script>

{#if emoji.startsWith('&#')}
<!-- eslint-disable svelte/no-at-html-tags -->
<span class="text-emoji">{@html emoji}</span>
{:else}
<img class="img-emoji" src={`/img/emojis/${emoji}`} alt={emoji.split('.')[0]} />
{/if}
<div class="emoji-container">
{#if emoji.startsWith('&#')}
<!-- eslint-disable svelte/no-at-html-tags -->
<span class="text-emoji">{@html emoji}</span>
{:else}
<img class="img-emoji" src={`/img/emojis/${emoji}`} alt={emoji.split('.')[0]} />
{/if}
</div>

<style scoped>
.emoji-container {
align-items: center;
display: flex;
height: var(--emoji-container-height, 32px);
justify-content: center;
width: var(--emoji-container-width, 32px);
}
.text-emoji {
font-size: var(--emoji-font-size, 24px);
}
Expand Down

0 comments on commit ef49417

Please sign in to comment.