logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

emoji_reactions.vue (4505B)


  1. <template>
  2. <div class="EmojiReactions">
  3. <span
  4. v-for="(reaction) in emojiReactions"
  5. :key="reaction.url || reaction.name"
  6. class="emoji-reaction-container btn-group"
  7. >
  8. <component
  9. :is="loggedIn ? 'button' : 'a'"
  10. v-bind="!loggedIn ? { href: remoteInteractionLink } : {}"
  11. role="button"
  12. class="emoji-reaction btn button-default"
  13. :class="{ '-picked-reaction': reactedWith(reaction.name), toggled: reactedWith(reaction.name) }"
  14. :title="reaction.url ? reaction.name : undefined"
  15. :aria-pressed="reactedWith(reaction.name)"
  16. @click="emojiOnClick(reaction.name, $event)"
  17. >
  18. <span
  19. class="reaction-emoji"
  20. >
  21. <StillImage
  22. v-if="reaction.url"
  23. :src="reaction.url"
  24. class="reaction-emoji-content"
  25. />
  26. <span
  27. v-else
  28. class="reaction-emoji reaction-emoji-content"
  29. >{{ reaction.name }}</span>
  30. </span>
  31. <FALayers>
  32. <FAIcon
  33. v-if="reactedWith(reaction.name)"
  34. class="active-marker"
  35. transform="shrink-6 up-9"
  36. icon="check"
  37. />
  38. <FAIcon
  39. v-if="!reactedWith(reaction.name)"
  40. class="focus-marker"
  41. transform="shrink-6 up-9"
  42. icon="plus"
  43. />
  44. <FAIcon
  45. v-else
  46. class="focus-marker"
  47. transform="shrink-6 up-9"
  48. icon="minus"
  49. />
  50. </FALayers>
  51. </component>
  52. <UserListPopover
  53. :users="accountsForEmoji[reaction.name]"
  54. class="emoji-reaction-popover"
  55. :trigger-attrs="counterTriggerAttrs(reaction)"
  56. @show="fetchEmojiReactionsByIfMissing()"
  57. >
  58. <span class="emoji-reaction-counts">{{ reaction.count }}</span>
  59. </UserListPopover>
  60. </span>
  61. <a
  62. v-if="tooManyReactions"
  63. class="emoji-reaction-expand faint"
  64. href="javascript:void(0)"
  65. @click="toggleShowAll"
  66. >
  67. {{ showAll ? $t('general.show_less') : showMoreString }}
  68. </a>
  69. </div>
  70. </template>
  71. <script src="./emoji_reactions.js"></script>
  72. <style lang="scss">
  73. @import "../../mixins";
  74. .EmojiReactions {
  75. display: flex;
  76. margin-top: 0.25em;
  77. flex-wrap: wrap;
  78. --emoji-size: calc(var(--emojiSize, 1.25em) * var(--emojiReactionsScale, 1));
  79. .emoji-reaction-container {
  80. display: flex;
  81. align-items: stretch;
  82. margin-top: 0.5em;
  83. margin-right: 0.5em;
  84. .emoji-reaction-popover {
  85. padding: 0;
  86. .emoji-reaction-count-button {
  87. margin: 0;
  88. height: 100%;
  89. border-top-left-radius: 0;
  90. border-bottom-left-radius: 0;
  91. box-sizing: border-box;
  92. min-width: 2em;
  93. display: inline-flex;
  94. justify-content: center;
  95. align-items: center;
  96. }
  97. }
  98. }
  99. .emoji-reaction {
  100. padding-left: 0.5em;
  101. display: flex;
  102. align-items: center;
  103. justify-content: center;
  104. box-sizing: border-box;
  105. border-top-right-radius: 0;
  106. border-bottom-right-radius: 0;
  107. margin: 0;
  108. .reaction-emoji {
  109. width: var(--emoji-size);
  110. height: var(--emoji-size);
  111. margin-right: 0.25em;
  112. line-height: var(--emoji-size);
  113. display: flex;
  114. justify-content: center;
  115. align-items: center;
  116. --_still_image-label-scale: 0.3;
  117. }
  118. .reaction-emoji-content {
  119. max-width: 100%;
  120. max-height: 100%;
  121. width: var(--emoji-size);
  122. height: var(--emoji-size);
  123. line-height: inherit;
  124. overflow: hidden;
  125. font-size: calc(var(--emoji-size) * 0.8);
  126. margin: 0;
  127. img {
  128. object-fit: contain;
  129. }
  130. }
  131. &:focus {
  132. outline: none;
  133. }
  134. .svg-inline--fa {
  135. color: var(--text);
  136. }
  137. &.-picked-reaction {
  138. .svg-inline--fa {
  139. color: var(--accent);
  140. }
  141. }
  142. @include unfocused-style {
  143. .focus-marker {
  144. visibility: hidden;
  145. }
  146. .active-marker {
  147. visibility: visible;
  148. }
  149. }
  150. @include focused-style {
  151. .svg-inline--fa {
  152. color: var(--accent);
  153. }
  154. .focus-marker {
  155. visibility: visible;
  156. }
  157. .active-marker {
  158. visibility: hidden;
  159. }
  160. }
  161. }
  162. .emoji-reaction-expand {
  163. padding: 0 0.5em;
  164. margin-right: 0.5em;
  165. margin-top: 0.5em;
  166. display: flex;
  167. align-items: center;
  168. justify-content: center;
  169. &:hover {
  170. text-decoration: underline;
  171. }
  172. }
  173. }
  174. </style>