Make reaction button accessible
This commit is contained in:
parent
1e597d8b1a
commit
ed23f51838
@ -1,5 +1,17 @@
|
|||||||
import UserAvatar from '../user_avatar/user_avatar.vue'
|
import UserAvatar from '../user_avatar/user_avatar.vue'
|
||||||
import UserListPopover from '../user_list_popover/user_list_popover.vue'
|
import UserListPopover from '../user_list_popover/user_list_popover.vue'
|
||||||
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||||
|
import {
|
||||||
|
faPlus,
|
||||||
|
faMinus,
|
||||||
|
faCheck
|
||||||
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
|
library.add(
|
||||||
|
faPlus,
|
||||||
|
faMinus,
|
||||||
|
faCheck
|
||||||
|
)
|
||||||
|
|
||||||
const EMOJI_REACTION_COUNT_CUTOFF = 12
|
const EMOJI_REACTION_COUNT_CUTOFF = 12
|
||||||
|
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="EmojiReactions">
|
<div class="EmojiReactions">
|
||||||
<UserListPopover
|
<span
|
||||||
v-for="(reaction) in emojiReactions"
|
v-for="(reaction) in emojiReactions"
|
||||||
:key="reaction.url || reaction.name"
|
:key="reaction.url || reaction.name"
|
||||||
:users="accountsForEmoji[reaction.name]"
|
class="emoji-reaction-container btn-group"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
class="emoji-reaction btn button-default"
|
class="emoji-reaction btn button-default"
|
||||||
:class="{ '-picked-reaction': reactedWith(reaction.name), 'not-clickable': !loggedIn }"
|
:class="{ '-picked-reaction': reactedWith(reaction.name), 'not-clickable': !loggedIn }"
|
||||||
@click="emojiOnClick(reaction.name, $event)"
|
@click="emojiOnClick(reaction.name, $event)"
|
||||||
@mouseenter="fetchEmojiReactionsByIfMissing()"
|
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="reaction-emoji"
|
class="reaction-emoji"
|
||||||
@ -26,9 +25,36 @@
|
|||||||
class="reaction-emoji reaction-emoji-content"
|
class="reaction-emoji reaction-emoji-content"
|
||||||
>{{ reaction.name }}</span>
|
>{{ reaction.name }}</span>
|
||||||
</span>
|
</span>
|
||||||
<span>{{ reaction.count }}</span>
|
<FALayers>
|
||||||
|
<FAIcon
|
||||||
|
v-if="reactedWith(reaction.name)"
|
||||||
|
class="active-marker"
|
||||||
|
transform="shrink-6 up-9"
|
||||||
|
icon="check"
|
||||||
|
/>
|
||||||
|
<FAIcon
|
||||||
|
v-if="!reactedWith(reaction.name)"
|
||||||
|
class="focus-marker"
|
||||||
|
transform="shrink-6 up-9"
|
||||||
|
icon="plus"
|
||||||
|
/>
|
||||||
|
<FAIcon
|
||||||
|
v-else
|
||||||
|
class="focus-marker"
|
||||||
|
transform="shrink-6 up-9"
|
||||||
|
icon="minus"
|
||||||
|
/>
|
||||||
|
</FALayers>
|
||||||
</button>
|
</button>
|
||||||
|
<UserListPopover
|
||||||
|
:users="accountsForEmoji[reaction.name]"
|
||||||
|
class="emoji-reaction-popover"
|
||||||
|
@show="fetchEmojiReactionsByIfMissing()"
|
||||||
|
:trigger-attrs="{ class: ['btn', 'button-default', 'emoji-reaction-count-button', { '-picked-reaction': reactedWith(reaction.name) }] }"
|
||||||
|
>
|
||||||
|
<span class="emoji-reaction-counts">{{ reaction.count }}</span>
|
||||||
</UserListPopover>
|
</UserListPopover>
|
||||||
|
</span>
|
||||||
<a
|
<a
|
||||||
v-if="tooManyReactions"
|
v-if="tooManyReactions"
|
||||||
class="emoji-reaction-expand faint"
|
class="emoji-reaction-expand faint"
|
||||||
@ -43,6 +69,7 @@
|
|||||||
<script src="./emoji_reactions.js"></script>
|
<script src="./emoji_reactions.js"></script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "../../variables";
|
@import "../../variables";
|
||||||
|
@import "../../mixins";
|
||||||
|
|
||||||
.EmojiReactions {
|
.EmojiReactions {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -51,10 +78,36 @@
|
|||||||
|
|
||||||
--emoji-size: calc(1.25em * var(--emojiReactionsScale, 1));
|
--emoji-size: calc(1.25em * var(--emojiReactionsScale, 1));
|
||||||
|
|
||||||
.emoji-reaction {
|
.emoji-reaction-container {
|
||||||
padding: 0 0.5em;
|
display: flex;
|
||||||
margin-right: 0.5em;
|
align-items: stretch;
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
|
||||||
|
.emoji-reaction-popover {
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
.emoji-reaction-count-button {
|
||||||
|
background-color: var(--btn);
|
||||||
|
height: 100%;
|
||||||
|
border-top-left-radius: 0;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-width: 2em;
|
||||||
|
display: inline-flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
&.-picked-reaction {
|
||||||
|
border: 1px solid var(--accent, $fallback--link);
|
||||||
|
margin-right: -1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.emoji-reaction {
|
||||||
|
padding-left: 0.5em;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@ -97,7 +150,42 @@
|
|||||||
&.-picked-reaction {
|
&.-picked-reaction {
|
||||||
border: 1px solid var(--accent, $fallback--link);
|
border: 1px solid var(--accent, $fallback--link);
|
||||||
margin-left: -1px; // offset the border, can't use inset shadows either
|
margin-left: -1px; // offset the border, can't use inset shadows either
|
||||||
margin-right: calc(0.5em - 1px);
|
margin-right: -1px;
|
||||||
|
|
||||||
|
.svg-inline--fa {
|
||||||
|
color: $fallback--link;
|
||||||
|
color: var(--accent, $fallback--link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include unfocused-style {
|
||||||
|
.svg-inline--fa {
|
||||||
|
color: $fallback--text;
|
||||||
|
color: var(--btnText, $fallback--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.focus-marker {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active-marker {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include focused-style {
|
||||||
|
.svg-inline--fa {
|
||||||
|
color: $fallback--link;
|
||||||
|
color: var(--accent, $fallback--link);
|
||||||
|
}
|
||||||
|
|
||||||
|
.focus-marker {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active-marker {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user