aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Emoji.svelte
blob: 1869f370b76880fde34d80a08543c3bb2dd3486d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!-- 
	@component
	
	All the emojis inside the value will be turned into Twemojis.
-->
<script lang="ts">
	// Interestingly, the comment above adds whitespace so we don't need to add
	// padding before the emoji like we usually would.
	// This is very likely a SvelteKit bug, so when it's fixed we should add
	// `margin-left: .25em` to .profile-emoji

	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>