1
0
forked from mirror/misskey
mi.moris.day/packages/frontend-embed/src/components/EmReactionsViewer.reaction.vue

100 lines
1.7 KiB
Vue
Raw Normal View History

2024-08-27 08:29:25 +09:00
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<button
class="_button"
2024-08-27 08:41:02 +09:00
:class="[$style.root, { [$style.reacted]: note.myReaction == reaction }]"
2024-08-27 08:29:25 +09:00
>
2024-08-27 08:44:59 +09:00
<EmReactionIcon :class="$style.limitWidth" :reaction="reaction" :emojiUrl="note.reactionEmojis[reaction.substring(1, reaction.length - 1)]"/>
2024-08-27 08:29:25 +09:00
<span :class="$style.count">{{ count }}</span>
</button>
</template>
<script lang="ts" setup>
2024-08-27 08:41:02 +09:00
import { } from 'vue';
2024-08-27 08:29:25 +09:00
import * as Misskey from 'misskey-js';
2024-08-27 08:44:59 +09:00
import EmReactionIcon from '@/components/EmReactionIcon.vue';
2024-08-27 08:29:25 +09:00
const props = defineProps<{
reaction: string;
count: number;
isInitial: boolean;
note: Misskey.entities.Note;
}>();
</script>
<style lang="scss" module>
.root {
display: inline-flex;
height: 42px;
margin: 2px;
padding: 0 6px;
font-size: 1.5em;
border-radius: 6px;
align-items: center;
justify-content: center;
&.canToggle {
background: var(--buttonBg);
&:hover {
background: rgba(0, 0, 0, 0.1);
}
}
&:not(.canToggle) {
cursor: default;
}
&.small {
height: 32px;
font-size: 1em;
border-radius: 4px;
> .count {
font-size: 0.9em;
line-height: 32px;
}
}
&.large {
height: 52px;
font-size: 2em;
border-radius: 8px;
> .count {
font-size: 0.6em;
line-height: 52px;
}
}
&.reacted, &.reacted:hover {
background: var(--accentedBg);
color: var(--accent);
box-shadow: 0 0 0 1px var(--accent) inset;
> .count {
color: var(--accent);
}
> .icon {
filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}
}
}
.limitWidth {
max-width: 70px;
object-fit: contain;
}
.count {
font-size: 0.7em;
line-height: 42px;
margin: 0 0 0 4px;
}
</style>