akkoma-fe/src/components/emoji_reactions/emoji_reactions.vue

96 lines
2.1 KiB
Vue
Raw Normal View History

2020-01-14 08:06:14 +00:00
<template>
<div class="emoji-reactions">
<UserListPopover
v-for="(reaction) in emojiReactions"
:key="reaction.name"
:users="accountsForEmoji[reaction.name]"
2020-01-14 08:06:14 +00:00
>
<button
class="emoji-reaction btn button-default"
2020-02-17 20:28:14 +00:00
:class="{ 'picked-reaction': reactedWith(reaction.name), 'not-clickable': !loggedIn }"
@click="emojiOnClick(reaction.name, $event)"
@mouseenter="fetchEmojiReactionsByIfMissing()"
>
2022-06-08 01:40:20 +00:00
<span
v-if="reaction.url !== null"
>
<img
:src="reaction.url"
class="reaction-emoji"
>
{{ reaction.count }}
</span>
<span v-else>
<span class="reaction-emoji">
{{ reaction.name }}
</span>
<span>{{ reaction.count }}</span>
</span>
</button>
</UserListPopover>
<a
2020-02-28 16:39:47 +00:00
v-if="tooManyReactions"
class="emoji-reaction-expand faint"
href="javascript:void(0)"
@click="toggleShowAll"
>
{{ showAll ? $t('general.show_less') : showMoreString }}
</a>
2020-01-14 08:06:14 +00:00
</div>
</template>
<script src="./emoji_reactions.js" ></script>
<style lang="scss">
@import '../../_variables.scss';
.emoji-reactions {
display: flex;
margin-top: 0.25em;
flex-wrap: wrap;
}
.emoji-reaction {
padding: 0 0.5em;
margin-right: 0.5em;
margin-top: 0.5em;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
.reaction-emoji {
2022-06-08 01:40:20 +00:00
width: 2.55em;
2020-01-14 08:06:14 +00:00
margin-right: 0.25em;
}
&:focus {
outline: none;
}
&.not-clickable {
cursor: default;
&:hover {
box-shadow: $fallback--buttonShadow;
box-shadow: var(--buttonShadow);
}
}
}
.emoji-reaction-expand {
padding: 0 0.5em;
margin-right: 0.5em;
margin-top: 0.5em;
display: flex;
align-items: center;
justify-content: center;
&:hover {
text-decoration: underline;
}
2020-01-14 08:06:14 +00:00
}
2020-02-17 20:28:14 +00:00
.picked-reaction {
border: 1px solid var(--accent, $fallback--link);
margin-left: -1px; // offset the border, can't use inset shadows either
margin-right: calc(0.5em - 1px);
}
2020-01-14 08:06:14 +00:00
</style>