Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix(ds): one height rail for icon and text buttons (#2202)

Guillem Arias Fauste7a0665a8f6c5
diff --git a/app/components/DS/buttonish.rb b/app/components/DS/buttonish.rb
index 3806cec43c..9d43d1aff8 100644
--- a/app/components/DS/buttonish.rb
+++ b/app/components/DS/buttonish.rb
@@ -34,16 +34,25 @@ class DS::Buttonish < DesignSystemComponent
}
}.freeze
+ # Icon-only containers share a height rail with the text buttons of the
+ # same size (sm ≈ 28px, md ≈ 36px, lg ≈ 48px), so a mixed row — icon
+ # trigger next to text buttons, the most common header layout — lines up
+ # instead of mixing 32/44px squares with 36px buttons.
+ #
+ # pointer-coarse restores the 44px square on touch devices: the visual
+ # rail is a pointer-precision tradeoff, and WCAG 2.5.5's 44x44 target
+ # minimum is about fingers, not mice. Coarse-pointer users get the full
+ # target; fine-pointer users get the aligned row.
SIZES = {
sm: {
container_classes: "px-2 py-1",
- icon_container_classes: "inline-flex items-center justify-center w-8 h-8",
+ icon_container_classes: "inline-flex items-center justify-center w-7 h-7 pointer-coarse:w-11 pointer-coarse:h-11",
radius_classes: "rounded-md",
text_classes: "text-sm"
},
md: {
container_classes: "px-3 py-2",
- icon_container_classes: "inline-flex items-center justify-center w-11 h-11",
+ icon_container_classes: "inline-flex items-center justify-center w-9 h-9 pointer-coarse:w-11 pointer-coarse:h-11",
radius_classes: "rounded-lg",
text_classes: "text-sm"
},
diff --git a/app/components/DS/popover.html.erb b/app/components/DS/popover.html.erb
index 7c73246da7..1f5baf58b3 100644
--- a/app/components/DS/popover.html.erb
+++ b/app/components/DS/popover.html.erb
@@ -9,7 +9,7 @@
the fallback `ds.popover.avatar_default_label` is used. %>
<button type="button"
data-DS--popover-target="button"
- class="inline-flex items-center justify-center w-11 h-11 cursor-pointer rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-900 theme-dark:focus-visible:outline-white"
+ class="inline-flex items-center justify-center w-9 h-9 pointer-coarse:w-11 pointer-coarse:h-11 cursor-pointer rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gray-900 theme-dark:focus-visible:outline-white"
aria-label="<%= trigger_aria_label %>"
aria-haspopup="dialog"
aria-expanded="false"
diff --git a/app/components/DS/select.html.erb b/app/components/DS/select.html.erb
index 1ac9b027fc..be136d9474 100644
--- a/app/components/DS/select.html.erb
+++ b/app/components/DS/select.html.erb
@@ -31,7 +31,7 @@
</button>
</div>
</div>
- <div class="absolute z-50 p-1.5 w-full min-w-32 rounded-lg shadow-lg shadow-border-xs bg-container mt-1.5 transition duration-150 ease-out -translate-y-1 opacity-0 hidden" data-select-target="menu">
+ <div class="absolute z-50 p-1.5 w-full min-w-32 rounded-lg shadow-border-lg bg-container mt-1.5 transition duration-150 ease-out -translate-y-1 opacity-0 hidden" data-select-target="menu">
<% if searchable %>
<div class="flex items-center bg-container border border-secondary rounded-lg mb-1 focus-within:ring-4 focus-within:ring-alpha-black-200 theme-dark:focus-within:ring-alpha-white-300 transition-shadow">
<%= render DS::SearchInput.new(
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 39077cc6ad..5a00adda67 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -60,7 +60,7 @@ end %>
<div class="flex items-center gap-1">
<button type="button"
- class="inline-flex items-center justify-center w-8 h-8 rounded-lg text-secondary hover:text-primary transition-colors"
+ class="inline-flex items-center justify-center w-9 h-9 pointer-coarse:w-11 pointer-coarse:h-11 rounded-lg text-secondary hover:text-primary hover:bg-container-inset-hover transition-colors"
data-action="click->privacy-mode#toggle"
data-privacy-mode-target="toggle"
title="<%= t("layouts.application.privacy_mode") %>"
@@ -158,7 +158,7 @@ end %>
<div class="flex items-center gap-2">
<button type="button"
- class="inline-flex items-center justify-center w-8 h-8 rounded-lg text-secondary hover:text-primary hover:bg-surface-hover transition-colors"
+ class="inline-flex items-center justify-center w-9 h-9 pointer-coarse:w-11 pointer-coarse:h-11 rounded-lg text-secondary hover:text-primary hover:bg-container-inset-hover transition-colors"
data-action="click->privacy-mode#toggle"
data-privacy-mode-target="toggle"
title="<%= t("layouts.application.privacy_mode") %>"