-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEmoji.svelte
54 lines (45 loc) · 1.05 KB
/
Emoji.svelte
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!--
Copyright © 2022 The Radicle Design System Contributors
This file is part of radicle-design-system, distributed under the GPLv3
with Radicle Linking Exception. For full terms see the included
LICENSE file.
-->
<script lang="ts">
type EmojiSize = "small" | "regular" | "large" | "huge";
import twemoji from "twemoji";
import { config } from "./lib/config";
export let emoji: string;
export let size: EmojiSize = "regular";
export let style: string | undefined = undefined;
</script>
<style>
.container {
display: flex;
align-items: center;
justify-content: center;
}
:global(.emoji.small) {
height: 0.75rem;
width: 0.75rem;
}
:global(.emoji.regular) {
height: 1rem;
width: 1rem;
}
:global(.emoji.large) {
height: 2rem;
width: 2rem;
}
:global(.emoji.huge) {
height: 3rem;
width: 3rem;
}
</style>
<div {style} class="container">
{@html twemoji.parse(emoji, {
className: `emoji ${size}`,
base: $config.assetPathPrefix,
folder: "/twemoji",
ext: ".svg",
})}
</div>