Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Give Bills' Next up strip a focus ring and one padding scale (#3877)

Guillem Arias Fausteba0d329a12a6
diff --git a/app/views/bills/_month_pulse.html.erb b/app/views/bills/_month_pulse.html.erb
index 3e232afa70..0b7b5b87ad 100644
--- a/app/views/bills/_month_pulse.html.erb
+++ b/app/views/bills/_month_pulse.html.erb
@@ -15,7 +15,7 @@
overdue: @past_due_total&.amount
) %>
-<div class="bg-container rounded-xl shadow-border-xs p-5 space-y-4">
+<div class="bg-container rounded-xl shadow-border-xs p-4 space-y-4">
<div class="flex items-baseline justify-between gap-3">
<p class="text-xs font-medium uppercase tracking-wide text-secondary"><%= l(Date.current, format: "%B") %></p>
<p class="text-xs text-secondary"><%= t(".bill_count", count: @month_bill_count) %></p>
@@ -79,7 +79,7 @@
<div class="flex items-center justify-between gap-3">
<p class="text-xs font-medium uppercase tracking-wide text-secondary"><%= t(".next_up") %></p>
<%= link_to t(".view_calendar"), bills_path(view: "calendar"),
- class: "text-xs text-link hover:underline shrink-0" %>
+ class: "text-xs text-link hover:underline shrink-0 focus-ring rounded-sm" %>
</div>
<%# A horizontal strip where there is room, a scrollable one where there
@@ -87,15 +87,16 @@
<div class="flex gap-2 overflow-x-auto no-scrollbar sm:grid sm:grid-cols-2 sm:overflow-visible lg:grid-cols-4">
<% @next_up.each do |occurrence| %>
<% series = occurrence.recurring_transaction %>
+ <%# Inset ring: on phones the scroll strip clips an outline drawn outside the item. %>
<%= link_to bill_path(series),
- class: "shrink-0 w-36 sm:w-auto rounded-lg px-2 py-1.5 -mx-2 hover:bg-surface-hover group" do %>
+ class: "shrink-0 w-36 sm:w-auto rounded-lg px-2 py-1.5 hover:bg-surface-hover focus-ring -outline-offset-2" do %>
<p class="text-xs text-secondary truncate">
<%= bills_next_up_date(occurrence) %>
<% if series.autopay? %>
&middot; <%= t("recurring_transactions.pay_action.autopay") %>
<% end %>
</p>
- <p class="text-sm text-primary truncate group-hover:underline"><%= series.display_name %></p>
+ <p class="text-sm text-primary truncate"><%= series.display_name %></p>
<p class="text-sm font-medium text-primary privacy-sensitive">
<% if occurrence.partially_paid? %>
<%= format_money(occurrence.remaining_amount_money) %>
diff --git a/app/views/bills/index.html.erb b/app/views/bills/index.html.erb
index ceb4734a27..fd2efc8f68 100644
--- a/app/views/bills/index.html.erb
+++ b/app/views/bills/index.html.erb
@@ -7,7 +7,7 @@
<%# Nothing here was confirmed by anyone: detection built it from bank data.
Says so once, and stops as soon as the user works with any of it. %>
<% if @detected_awaiting_review.positive? %>
- <div class="bg-container rounded-xl shadow-border-xs px-4 py-3 flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1">
+ <div class="bg-container rounded-xl shadow-border-xs p-4 flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1">
<p class="text-sm text-primary">
<%= t(".detected_review", count: @detected_awaiting_review) %>
</p>
diff --git a/test/controllers/bills_controller_test.rb b/test/controllers/bills_controller_test.rb
index 12f58379dd..44b9529e9e 100644
--- a/test/controllers/bills_controller_test.rb
+++ b/test/controllers/bills_controller_test.rb
@@ -176,6 +176,18 @@ class BillsControllerTest < ActionDispatch::IntegrationTest
assert_match I18n.t("bills.month_pulse.next_up"), body
assert_match "Amazon Prime", body
+ # Next-up items and the calendar link carry the DS focus ring, and the
+ # items no longer bleed past the strip that clips them on phones.
+ assert_select "a.focus-ring", text: I18n.t("bills.month_pulse.view_calendar")
+ assert_select "a.w-36[href^='/bills/']", text: /Amazon Prime/ do |links|
+ links.each do |link|
+ classes = link["class"].split
+ assert_includes classes, "focus-ring"
+ assert_not_includes classes, "-mx-2"
+ assert_not_includes link.to_html, "group-hover:underline", "the tint is the one hover cue"
+ end
+ end
+
assert_match I18n.t("bills.month_pulse.left_to_pay"), body
assert_no_match(/ProgressRing|rounded-full[^"]*stroke/, body,
"the donut is gone; progress is a rule, not a centrepiece")