2021-09-17 08:39:15 -05:00
|
|
|
<template>
|
|
|
|
<button class="zuvgdzyu _button" @click="menu">
|
2023-01-23 01:19:13 -06:00
|
|
|
<img :src="emoji.url" class="img" loading="lazy"/>
|
2021-09-17 08:39:15 -05:00
|
|
|
<div class="body">
|
|
|
|
<div class="name _monospace">{{ emoji.name }}</div>
|
|
|
|
<div class="info">{{ emoji.aliases.join(' ') }}</div>
|
|
|
|
</div>
|
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
|
2022-01-12 11:36:51 -06:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2021-11-11 11:02:25 -06:00
|
|
|
import * as os from '@/os';
|
|
|
|
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
2022-01-12 11:36:51 -06:00
|
|
|
import { i18n } from '@/i18n';
|
2021-09-17 08:39:15 -05:00
|
|
|
|
2022-01-12 11:36:51 -06:00
|
|
|
const props = defineProps<{
|
2023-01-23 01:19:13 -06:00
|
|
|
emoji: {
|
|
|
|
name: string;
|
|
|
|
aliases: string[];
|
|
|
|
category: string;
|
|
|
|
url: string;
|
|
|
|
};
|
2022-01-12 11:36:51 -06:00
|
|
|
}>();
|
2021-09-17 08:39:15 -05:00
|
|
|
|
2022-01-12 11:36:51 -06:00
|
|
|
function menu(ev) {
|
|
|
|
os.popupMenu([{
|
|
|
|
type: 'label',
|
|
|
|
text: ':' + props.emoji.name + ':',
|
|
|
|
}, {
|
2022-01-27 20:39:49 -06:00
|
|
|
text: i18n.ts.copy,
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-copy',
|
2022-01-12 11:36:51 -06:00
|
|
|
action: () => {
|
|
|
|
copyToClipboard(`:${props.emoji.name}:`);
|
|
|
|
os.success();
|
2022-12-22 01:01:59 -06:00
|
|
|
},
|
2023-03-17 06:24:47 -05:00
|
|
|
}, {
|
|
|
|
text: i18n.ts.info,
|
|
|
|
icon: 'ti ti-info-circle',
|
|
|
|
action: () => {
|
|
|
|
os.apiGet('emoji', { name: props.emoji.name }).then(res => {
|
|
|
|
os.alert({
|
|
|
|
type: 'info',
|
|
|
|
text: `License: ${res.license}`,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
2022-01-27 20:53:12 -06:00
|
|
|
}], ev.currentTarget ?? ev.target);
|
2022-01-12 11:36:51 -06:00
|
|
|
}
|
2021-09-17 08:39:15 -05:00
|
|
|
</script>
|
|
|
|
|
2022-12-27 03:29:39 -06:00
|
|
|
<style lang="scss" scoped>
|
2021-09-17 08:39:15 -05:00
|
|
|
.zuvgdzyu {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
padding: 12px;
|
|
|
|
text-align: left;
|
|
|
|
background: var(--panel);
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
border-color: var(--accent);
|
|
|
|
}
|
|
|
|
|
|
|
|
> .img {
|
|
|
|
width: 42px;
|
|
|
|
height: 42px;
|
2023-01-08 22:56:30 -06:00
|
|
|
object-fit: contain;
|
2021-09-17 08:39:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
> .body {
|
|
|
|
padding: 0 0 0 8px;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
> .name {
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .info {
|
|
|
|
opacity: 0.5;
|
|
|
|
font-size: 0.9em;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|