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

108 lines
2.2 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
2023-05-16 17:44:19 +02:00
<button v-if="emoji.draft" class="zuvgdzyu _button emoji-draft" @click="menu">
<img :src="emoji.url" class="img" loading="lazy"/>
<div class="body">
<div class="name _monospace">{{ emoji.name + ' (draft)' }}</div>
<div class="info">{{ emoji.aliases.join(' ') }}</div>
</div>
</button>
<button v-else class="_button" :class="$style.root" @click="menu">
2023-05-19 09:20:53 +02:00
<img :src="emoji.url" :class="$style.img" loading="lazy"/>
<div :class="$style.body">
<div :class="$style.name" class="_monospace">{{ emoji.name }}</div>
<div :class="$style.info">{{ emoji.aliases.join(' ') }}</div>
</div>
</button>
</template>
<script lang="ts" setup>
2023-09-19 09:37:43 +02:00
import * as os from '@/os.js';
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
emoji: {
name: string;
aliases: string[];
category: string;
url: string;
2023-05-16 17:44:19 +02:00
draft: boolean;
};
}>();
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();
},
}, {
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-28 03:53:12 +01:00
}], ev.currentTarget ?? ev.target);
}
</script>
2023-05-19 09:20:53 +02:00
<style lang="scss" module>
.root {
display: flex;
align-items: center;
padding: 12px;
text-align: left;
background: var(--panel);
border-radius: 8px;
&:hover {
border-color: var(--accent);
}
2023-05-19 09:20:53 +02:00
}
2023-05-19 09:20:53 +02:00
.img {
width: 42px;
height: 42px;
object-fit: contain;
}
2023-05-19 09:20:53 +02:00
.body {
padding: 0 0 0 8px;
white-space: nowrap;
overflow: hidden;
}
2023-05-19 09:20:53 +02:00
.name {
text-overflow: ellipsis;
overflow: hidden;
}
2023-05-19 09:20:53 +02:00
.info {
opacity: 0.5;
font-size: 0.9em;
text-overflow: ellipsis;
overflow: hidden;
}
2023-05-16 17:44:19 +02:00
.emoji-draft {
--c: rgb(255 196 0 / 15%);;
background-image: linear-gradient(45deg,var(--c) 16.67%,transparent 16.67%,transparent 50%,var(--c) 50%,var(--c) 66.67%,transparent 66.67%,transparent 100%);
background-size: 16px 16px;
}
</style>