aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Emoji.svelte
blob: 4eee2ea4d3f8ca1dd4837b72f4c9643e0923f4e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<script lang="ts">
	// All the emojis inside the value will be turned into Twemojis.

	// Note: We can't make an @component comment because SvelteKit is dumb and
	// will replace the comment with whitespace

	import { twemojiHtml } from './utils'

	export let value: string
</script>

<span>{@html twemojiHtml(value)}</span>

<style>
	:global(.emoji) {
		position: relative;
		/* we specify the width so it doesn't change size when the image shows up */
		width: 1em;
		height: 1em;
		vertical-align: text-bottom;
		bottom: 0.1em;
	}
</style>