diff --git a/app/assets/stylesheets/reactions.css b/app/assets/stylesheets/reactions.css index 7414bbcd8..4ca08616f 100644 --- a/app/assets/stylesheets/reactions.css +++ b/app/assets/stylesheets/reactions.css @@ -4,6 +4,11 @@ --reaction-border-color: var(--color-ink-lighter); --row-gap: 0; + align-items: center; + display: flex; + flex-wrap: wrap; + gap: var(--inline-space-half); + inline-size: 100%; margin-block-start: calc(var(--block-space-half) / 2); margin-inline: calc(var(--column-gap) / -1); } @@ -48,7 +53,6 @@ --btn-border-color: var(--reaction-border-color); font-size: 0.74em; - margin-block-start: calc(var(--block-space-half) / 2); @media (any-hover: hover) { &:where(:not(:active):hover) { @@ -87,4 +91,31 @@ .reaction--deleting { animation: scale-fade-out 0.2s both; } + + .reaction__popup { + --panel-padding: 0.5ch; + --offset: calc(-1 * var(--panel-padding)); + + inset: var(--offset) auto auto var(--offset); + min-inline-size: auto; + transform: none; + } + + .reaction__quick-emojis { + display: grid; + grid-template-columns: repeat(3, 1fr); + + .btn { + --btn-icon-size: 1.5ch; + --btn-size: 1.75rem; + + position: relative; + + @media (any-hover: hover) { + &:hover { + z-index: 1; + } + } + } + } } diff --git a/app/helpers/emoji_helper.rb b/app/helpers/emoji_helper.rb new file mode 100644 index 000000000..fd959ce8a --- /dev/null +++ b/app/helpers/emoji_helper.rb @@ -0,0 +1,12 @@ +module EmojiHelper + REACTIONS = { + "👍" => "Thumbs up", + "👏" => "Clapping", + "👋" => "Waving hand", + "💪" => "Muscle", + "❤️" => "Red heart", + "😂" => "Face with tears of joy", + "🎉" => "Party popper", + "🔥" => "Fire" + } +end diff --git a/app/views/cards/comments/reactions/_reactions.html.erb b/app/views/cards/comments/reactions/_reactions.html.erb index 1998f31d3..22bc0c9fa 100644 --- a/app/views/cards/comments/reactions/_reactions.html.erb +++ b/app/views/cards/comments/reactions/_reactions.html.erb @@ -1,16 +1,37 @@ <%= turbo_frame_tag comment, :reacting do %> -
+
<%= render partial: "cards/comments/reactions/reaction", collection: comment.reactions.includes(:reacter).ordered %>
<%= turbo_frame_tag comment, :new_reaction do %> -
- <%= link_to new_card_comment_reaction_path(comment.card, comment), role: "button", - class: "btn reaction__action", action: "soft-keyboard#open" do %> - <%= icon_tag "reaction" %> Add a reaction - <% end %> +
+ + + +
+ <% EmojiHelper::REACTIONS.each do |character, title| %> + <%= form_with model: [ comment.card, comment, Reaction.new ], data: { turbo_frame: dom_id(comment, :new_reaction), action: "dialog#close"} do |form| %> + <%= hidden_field_tag "comment[content]", character %> + <%= form.button type: "submit", title: title, class: "reaction__quick-emoji-btn btn btn--circle borderless", data: { emoji: character } do %> + <%= character %> + <%= title %> + <% end %> + <% end %> + <% end %> + +
+ <%= link_to new_card_comment_reaction_path(comment.card, comment), role: "button", + class: "btn btn--circle borderless", action: "soft-keyboard#open" do %> + <%= icon_tag "reaction" %> Add a reaction + <% end %> +
+
+
<% end %> +
<% end %>