forked from Easterok/telegram-onboarding-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Emodji.vue
62 lines (47 loc) · 1.13 KB
/
Emodji.vue
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
55
56
57
58
59
60
61
62
<template>
<div v-bind="props" :class="$style.emodji">
<span :class="$style.text">{{ src }}</span>
</div>
</template>
<script setup lang="ts">
import { computed, toRefs } from 'vue';
import type { EmodjiPresetProps } from './Media.preset.props';
const props = defineProps<EmodjiPresetProps>();
const { size } = toRefs(props);
const computedSize = computed(() => {
const _size = size?.value;
if (!_size) {
return {
width: '1.625em',
height: '1.625em',
};
}
if (typeof _size === 'number') {
return {
width: `${_size}px`,
height: `${_size}px`,
};
}
return {
width: `${_size[0]}px`,
height: `${_size[1]}px`,
};
});
const width = computed(() => computedSize.value.width);
const height = computed(() => computedSize.value.height);
</script>
<style lang="scss" module>
@import '@tok/ui/styles/local.scss';
.emodji {
@include size(v-bind(width), v-bind(height));
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 100%;
font: var(--tok-font-h4);
background: var(--tok-background-color);
}
.text {
font-size: 0.825em;
}
</style>