logo

pleroma-fe

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

emoji_reactions.vue (4625B)


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