Sharkey/packages/frontend/src/pages/emojis.emoji.vue

74 lines
1.3 KiB
Vue
Raw Normal View History

<template>
<button class="zuvgdzyu _button" @click="menu">
2022-12-29 18:06:38 -08:00
<img :src="`/emoji/${emoji.name}.webp`" class="img" :alt="emoji.name"/>
<div class="body">
<div class="name _monospace">{{ emoji.name }}</div>
<div class="info">{{ emoji.aliases.join(' ') }}</div>
</div>
</button>
</template>
<script lang="ts" setup>
import { } from 'vue';
2021-11-11 09:02:25 -08:00
import * as os from '@/os';
import copyToClipboard from '@/scripts/copy-to-clipboard';
import { i18n } from '@/i18n';
const props = defineProps<{
emoji: Record<string, unknown>; // TODO
}>();
function menu(ev) {
os.popupMenu([{
type: 'label',
text: ':' + props.emoji.name + ':',
}, {
text: i18n.ts.copy,
icon: 'ti ti-copy',
action: () => {
copyToClipboard(`:${props.emoji.name}:`);
os.success();
},
2022-01-27 18:53:12 -08:00
}], ev.currentTarget ?? ev.target);
}
</script>
<style lang="scss" scoped>
.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 20:56:30 -08:00
object-fit: contain;
}
> .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>