From fe00a437866158a0cb07d11774a30ca3820e9804 Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 27 Oct 2025 14:27:55 -0500 Subject: [PATCH] Nicer submit and cancel buttons --- app/assets/stylesheets/reactions.css | 100 ++++++++++-------- .../cards/comments/reactions/_menu.html.erb | 10 +- .../cards/comments/reactions/new.html.erb | 4 +- 3 files changed, 60 insertions(+), 54 deletions(-) diff --git a/app/assets/stylesheets/reactions.css b/app/assets/stylesheets/reactions.css index 1d16b38da..2e4f63451 100644 --- a/app/assets/stylesheets/reactions.css +++ b/app/assets/stylesheets/reactions.css @@ -28,52 +28,6 @@ } } - /* Menu - /* ------------------------------------------------------------------------ */ - - .reactions__menu { - position: relative; - } - - .reactions__trigger { - --btn-border-color: var(--reaction-border-color); - --btn-size: var(--reaction-size); - - font-size: 0.75em; - - .reactions:not(:has(.reaction)) & { - } - } - - .reactions__popup { - --panel-border-radius: 1.2em; - --panel-padding: 0.5ch; - --offset: calc(-1 * var(--panel-padding)); - - inset: var(--offset) auto auto var(--offset); - min-inline-size: auto; - transform: none; - } - - .reactions__emoji-list { - display: grid; - grid-template-columns: repeat(3, 1fr); - - .btn { - --btn-icon-size: 1.5ch; - --btn-size: var(--reaction-size); - --btn-border-color: var(--color-canvas); - - position: relative; - - /* Make sure the selection ring sits on top of adjacent buttons on hover */ - &:hover, - &:focus-visible { - z-index: 1; - } - } - } - /* Single reaction /* -------------------------------------------------------------------------- */ @@ -87,7 +41,7 @@ border: 1px solid var(--reaction-border-color); border-radius: 4rem; display: inline-flex; - gap: var(--column-gap); + gap: 0.25ch; max-inline-size: 100%; opacity: 1; padding: 0.1em 0.12em; @@ -164,4 +118,56 @@ .reaction--deleting { animation: scale-fade-out 0.2s both; } + + .reaction__menu-btn, + .reaction__submit-btn, + .reaction__cancel-btn { + --btn-size: 1.25rem; + --icon-size: var(--btn-size); + } + + .reaction__submit-btn { + color: oklch(var(--lch-green-dark)); + } + + .reaction__cancel-btn { + color: oklch(var(--lch-red-dark)); + } + + + /* Menu + /* ------------------------------------------------------------------------ */ + + .reaction__menu { + position: relative; + } + + .reaction__popup { + --panel-border-radius: 1.2em; + --panel-padding: 0.5ch; + --offset: calc(-1 * var(--panel-padding)); + + inset: var(--offset) auto auto var(--offset); + min-inline-size: auto; + transform: none; + } + + .reaction__emoji-list { + display: grid; + grid-template-columns: repeat(3, 1fr); + + .btn { + --btn-icon-size: 1.5ch; + --btn-size: var(--reaction-size); + --btn-border-color: var(--color-canvas); + + position: relative; + + /* Make sure the selection ring sits on top of adjacent buttons on hover */ + &:hover, + &:focus-visible { + z-index: 1; + } + } + } } diff --git a/app/views/cards/comments/reactions/_menu.html.erb b/app/views/cards/comments/reactions/_menu.html.erb index 20223bb8b..d975e6aec 100644 --- a/app/views/cards/comments/reactions/_menu.html.erb +++ b/app/views/cards/comments/reactions/_menu.html.erb @@ -1,12 +1,12 @@ -
- - -
+ +
<% EmojiHelper::REACTIONS.each do |character, title| %> - <%= tag.button character, title: title, class: "reactions__emoji-btn btn btn--circle", data: { action: "reaction-emoji#insertEmoji", emoji: character } %> + <%= tag.button character, title: title, class: "reaction__emoji-btn btn btn--circle", data: { action: "reaction-emoji#insertEmoji", emoji: character } %> <% end %>
diff --git a/app/views/cards/comments/reactions/new.html.erb b/app/views/cards/comments/reactions/new.html.erb index 4e7450ce1..38c6daf98 100644 --- a/app/views/cards/comments/reactions/new.html.erb +++ b/app/views/cards/comments/reactions/new.html.erb @@ -14,12 +14,12 @@ <%= render "cards/comments/reactions/menu", comment: @comment %> - <%= form.button class: "btn btn--circle borderless btn--reversed", type: "submit", data: { form_target: "submit" } do %> + <%= form.button class: "reaction__submit-btn btn btn--circle borderless", type: "submit", data: { form_target: "submit" } do %> <%= icon_tag "check-circle" %> Submit <% end %> <%= link_to card_comment_reactions_path(@comment.card, @comment), role: "button", - data: { turbo_frame: dom_id(@comment, :reacting), form_target: "cancel" }, class: "btn btn--circle borderless btn--negative" do %> + data: { turbo_frame: dom_id(@comment, :reacting), form_target: "cancel" }, class: "reaction__cancel-btn btn btn--circle borderless" do %> <%= icon_tag "close-circle" %> Cancel <% end %> <% end %>