From 5166899c97f93aa94bdaf41aeb21b75b4b2e7b68 Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Mon, 28 Apr 2025 19:32:21 -0400 Subject: [PATCH] Centralized icon helper --- app/components/button_component.rb | 4 +++ app/components/buttonish_component.rb | 5 +-- app/components/link_component.rb | 5 --- app/helpers/application_helper.rb | 23 ++++++++++--- app/views/accounts/_account.html.erb | 2 +- .../accounts/_account_sidebar_tabs.html.erb | 6 ++-- app/views/accounts/_account_type.html.erb | 4 +-- .../accounts/_accountable_group.html.erb | 2 +- app/views/accounts/_empty.html.erb | 9 ++--- .../accounts/index/_manual_accounts.html.erb | 4 +-- app/views/accounts/new.html.erb | 4 +-- app/views/accounts/new/_container.html.erb | 34 ++++++++++++------- .../accounts/new/_method_selector.html.erb | 6 ++-- app/views/accounts/show/_activity.html.erb | 2 +- app/views/accounts/show/_header.html.erb | 24 +++++++++---- .../_assistant_message.html.erb | 2 +- .../assistant_messages/_tool_calls.html.erb | 2 +- .../_budget_category_donut.html.erb | 4 ++- app/views/categories/_category.html.erb | 4 +-- .../layouts/shared/_breadcrumbs.html.erb | 4 +-- .../shared/_custom_confirm_dialog.html.erb | 7 +--- app/views/layouts/shared/_htmldoc.html.erb | 4 +-- app/views/layouts/sidebar/_nav_item.html.erb | 2 +- app/views/messages/_chat_form.html.erb | 4 +-- app/views/plaid_items/_plaid_item.html.erb | 8 ++--- app/views/rule/actions/_action.html.erb | 11 +++--- app/views/rule/conditions/_condition.html.erb | 6 ++-- .../rule/conditions/_condition_group.html.erb | 6 ++-- app/views/shared/_icon.html.erb | 6 ---- app/views/shared/_icon_custom.html.erb | 6 ---- app/views/shared/_icon_image.html.erb | 6 ---- app/views/transactions/show.html.erb | 14 ++++---- 32 files changed, 122 insertions(+), 108 deletions(-) delete mode 100644 app/views/shared/_icon.html.erb delete mode 100644 app/views/shared/_icon_custom.html.erb delete mode 100644 app/views/shared/_icon_image.html.erb diff --git a/app/components/button_component.rb b/app/components/button_component.rb index 7e9d0bf5..36600a3c 100644 --- a/app/components/button_component.rb +++ b/app/components/button_component.rb @@ -29,6 +29,10 @@ class ButtonComponent < ButtonishComponent data = data.merge(turbo_confirm: confirm.to_data_attribute) end + if frame.present? + data = data.merge(turbo_frame: frame) + end + merged_opts.merge( class: class_names(container_classes, extra_classes), data: data diff --git a/app/components/buttonish_component.rb b/app/components/buttonish_component.rb index e429bb28..4743616e 100644 --- a/app/components/buttonish_component.rb +++ b/app/components/buttonish_component.rb @@ -58,9 +58,9 @@ class ButtonishComponent < ViewComponent::Base } }.freeze - attr_reader :variant, :size, :href, :icon, :icon_position, :text, :full_width, :extra_classes, :opts + attr_reader :variant, :size, :href, :icon, :icon_position, :text, :full_width, :extra_classes, :frame, :opts - def initialize(variant: :primary, size: :md, href: nil, text: nil, icon: nil, icon_position: :left, full_width: false, **opts) + def initialize(variant: :primary, size: :md, href: nil, text: nil, icon: nil, icon_position: :left, full_width: false, frame: nil, **opts) @variant = variant.to_s.underscore.to_sym @size = size.to_sym @href = href @@ -69,6 +69,7 @@ class ButtonishComponent < ViewComponent::Base @text = text @full_width = full_width @extra_classes = opts.delete(:class) + @frame = frame @opts = opts end diff --git a/app/components/link_component.rb b/app/components/link_component.rb index f4662dd8..4bbe10e5 100644 --- a/app/components/link_component.rb +++ b/app/components/link_component.rb @@ -10,11 +10,6 @@ class LinkComponent < ButtonishComponent } ).freeze - def initialize(frame: nil, **opts) - super(**opts) - @frame = frame - end - def merged_opts merged_opts = opts.dup || {} data = merged_opts.delete(:data) || {} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 316e7900..abccd558 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,12 +1,25 @@ module ApplicationHelper include Pagy::Frontend - def icon(key, size: "md", color: "current") - render partial: "shared/icon", locals: { key:, size:, color: } - end + def icon(key, size: "md", color: "default", custom: false, as_button: false, **opts) + extra_classes = opts.delete(:class) + sizes = { xs: "w-3 h-3", sm: "w-4 h-4", md: "w-5 h-5", lg: "w-6 h-6" } + colors = { default: "fg-gray", success: "text-success", warning: "text-warning", destructive: "text-destructive", current: "text-current" } - def icon_custom(key, size: "md", color: "current") - render partial: "shared/icon_custom", locals: { key:, size:, color: } + icon_classes = class_names( + "shrink-0", + sizes[size.to_sym], + colors[color.to_sym], + extra_classes + ) + + if custom + inline_svg_tag("#{key}.svg", class: icon_classes, **opts) + elsif as_button + render ButtonComponent.new(variant: "icon", class: extra_classes, icon: key, size: size, type: "button", **opts) + else + lucide_icon(key, class: icon_classes, **opts) + end end # Convert alpha (0-1) to 8-digit hex (00-FF) diff --git a/app/views/accounts/_account.html.erb b/app/views/accounts/_account.html.erb index 9dc2b860..07ffd3d5 100644 --- a/app/views/accounts/_account.html.erb +++ b/app/views/accounts/_account.html.erb @@ -25,7 +25,7 @@ <% unless account.scheduled_for_deletion? %> <%= link_to edit_account_path(account, return_to: return_to), data: { turbo_frame: :modal }, class: "group-hover/account:flex hidden hover:opacity-80 items-center justify-center" do %> - <%= lucide_icon "pencil-line", class: "w-4 h-4 text-secondary" %> + <%= icon("pencil-line", size: "sm") %> <% end %> <% end %> diff --git a/app/views/accounts/_account_sidebar_tabs.html.erb b/app/views/accounts/_account_sidebar_tabs.html.erb index a8918de8..5dfce30d 100644 --- a/app/views/accounts/_account_sidebar_tabs.html.erb +++ b/app/views/accounts/_account_sidebar_tabs.html.erb @@ -1,15 +1,15 @@ <%# locals: (family:, active_account_group_tab:) %>
- <% if family.requires_data_provider? && Provider::Registry.get_provider(:synth).nil? %> + <% if family.requires_data_provider? && Provider::Registry.get_provider(:synth).nil? || true %>
- <%= icon "triangle-alert", size: "sm" %> + <%= icon "triangle-alert", size: "sm", color: "warning" %>

Missing historical data

- <%= lucide_icon "chevron-down", class: "text-yellow-600 group-open:transform group-open:rotate-180 w-5" %> + <%= icon("chevron-down", color: "warning", class: "group-open:transform group-open:rotate-180") %>

Maybe uses Synth API to fetch historical exchange rates, security prices, and more. This data is required to calculate accurate historical account balances.

diff --git a/app/views/accounts/_account_type.html.erb b/app/views/accounts/_account_type.html.erb index cb96352e..9dafd9de 100644 --- a/app/views/accounts/_account_type.html.erb +++ b/app/views/accounts/_account_type.html.erb @@ -2,8 +2,8 @@ <%= link_to new_polymorphic_path(accountable, step: "method_select", return_to: params[:return_to]), class: "flex items-center gap-4 w-full text-center focus:outline-hidden hover:bg-surface-hover focus:bg-surface-hover fg-primary border border-transparent block px-2 rounded-lg p-2" do %> - - <%= lucide_icon(accountable.icon, style: "color: #{accountable.color}", class: "w-5 h-5") %> + + <%= icon(accountable.icon, color: "current") %> <%= accountable.display_name.singularize %> <% end %> diff --git a/app/views/accounts/_accountable_group.html.erb b/app/views/accounts/_accountable_group.html.erb index 34c63231..e91d7b7e 100644 --- a/app/views/accounts/_accountable_group.html.erb +++ b/app/views/accounts/_accountable_group.html.erb @@ -2,7 +2,7 @@
- <%= lucide_icon("chevron-right", class: "group-open:rotate-90 text-secondary w-5 h-5") %> + <%= icon("chevron-right", class: "group-open:rotate-90") %> <%= tag.p account_group.name, class: "text-sm font-medium" %> diff --git a/app/views/accounts/_empty.html.erb b/app/views/accounts/_empty.html.erb index 6a1b6c89..a1eef715 100644 --- a/app/views/accounts/_empty.html.erb +++ b/app/views/accounts/_empty.html.erb @@ -3,9 +3,10 @@ <%= tag.p t(".no_accounts"), class: "text-primary mb-1 font-medium" %> <%= tag.p t(".empty_message"), class: "text-secondary mb-4" %> - <%= link_to new_account_path, class: "w-fit flex text-white text-sm font-medium items-center gap-1 bg-gray-900 rounded-lg p-2 pr-3", data: { turbo_frame: "modal" } do %> - <%= lucide_icon("plus", class: "w-5 h-5") %> - <%= t(".new_account") %> - <% end %> + <%= render LinkComponent.new( + text: t(".new_account"), + href: new_account_path, + frame: :modal + ) %>
diff --git a/app/views/accounts/index/_manual_accounts.html.erb b/app/views/accounts/index/_manual_accounts.html.erb index b20c400e..0dd8f66d 100644 --- a/app/views/accounts/index/_manual_accounts.html.erb +++ b/app/views/accounts/index/_manual_accounts.html.erb @@ -2,10 +2,10 @@
- <%= lucide_icon "chevron-right", class: "group-open:transform group-open:rotate-90 text-secondary w-5" %> + <%= icon("chevron-right", class: "group-open:transform group-open:rotate-90") %>
- <%= lucide_icon("folder-pen", class: "w-5 h-5 text-secondary") %> + <%= icon("folder-pen") %>
<%= t(".other_accounts") %> diff --git a/app/views/accounts/new.html.erb b/app/views/accounts/new.html.erb index 7a3c6a70..7a9248c2 100644 --- a/app/views/accounts/new.html.erb +++ b/app/views/accounts/new.html.erb @@ -25,8 +25,8 @@ <%= button_to imports_path(import: { type: "AccountImport" }), data: { turbo_frame: :_top }, class: "flex items-center gap-4 w-full text-center focus:outline-hidden hover:bg-surface-hover focus:bg-surface-hover fg-primary border border-transparent block px-2 rounded-lg p-2" do %> - - <%= lucide_icon("download", style: "color: #F79009", class: "w-5 h-5") %> + + <%= icon("download", color: "current") %> <%= t("accounts.new.import_accounts") %> <% end %> diff --git a/app/views/accounts/new/_container.html.erb b/app/views/accounts/new/_container.html.erb index d83d2e8c..3404b82d 100644 --- a/app/views/accounts/new/_container.html.erb +++ b/app/views/accounts/new/_container.html.erb @@ -2,17 +2,21 @@ <%= modal do %>
-
- <% if back_path %> - <%= link_to back_path, class: "flex w-8 h-8 shrink-0 grow-0 items-center justify-center rounded-lg bg-alpha-black-50 focus:outline-gray-300 focus:outline" do %> - <%= lucide_icon("arrow-left", class: "text-secondary w-5 h-5") %> +
+
+ <% if back_path %> + <%= render LinkComponent.new( + variant: "icon", + icon: "arrow-left", + href: back_path, + size: "lg" + ) %> <% end %> - <% end %> - <%= title %> - + <%= title %> +
+ + <%= icon("x", as_button: true, size: "lg", data: { action: "modal#close" }) %>
@@ -26,12 +30,18 @@
Select - <%= lucide_icon("corner-down-left", class: "inline w-3 h-3") %> + + <%= icon("corner-down-left", size: "xs") %> +
Navigate - <%= lucide_icon("arrow-up", class: "inline w-3 h-3") %> - <%= lucide_icon("arrow-down", class: "inline w-3 h-3") %> + + <%= icon("arrow-up", size: "xs") %> + + + <%= icon("arrow-down", size: "xs") %> +
diff --git a/app/views/accounts/new/_method_selector.html.erb b/app/views/accounts/new/_method_selector.html.erb index 62f7e588..18a03f8d 100644 --- a/app/views/accounts/new/_method_selector.html.erb +++ b/app/views/accounts/new/_method_selector.html.erb @@ -4,7 +4,7 @@
<%= link_to path, class: "flex items-center gap-4 w-full text-center text-primary focus:outline-hidden focus:bg-surface border border-transparent focus:border focus:border-gray-200 px-2 hover:bg-surface rounded-lg p-2" do %> - <%= lucide_icon("keyboard", class: "text-secondary w-5 h-5") %> + <%= icon("keyboard") %> <%= t("accounts.new.method_selector.manual_entry") %> <% end %> @@ -13,7 +13,7 @@ <%# Default US-only Link %> @@ -23,7 +23,7 @@ <% if eu_link_token %> diff --git a/app/views/accounts/show/_activity.html.erb b/app/views/accounts/show/_activity.html.erb index 5421a783..00bf610d 100644 --- a/app/views/accounts/show/_activity.html.erb +++ b/app/views/accounts/show/_activity.html.erb @@ -37,7 +37,7 @@
- <%= lucide_icon("search", class: "w-5 h-5 text-secondary") %> + <%= icon("search") %> <%= hidden_field_tag :account_id, @account.id %> <%= form.search_field :search, placeholder: "Search entries by name", diff --git a/app/views/accounts/show/_header.html.erb b/app/views/accounts/show/_header.html.erb index 6d822711..be83bed6 100644 --- a/app/views/accounts/show/_header.html.erb +++ b/app/views/accounts/show/_header.html.erb @@ -19,17 +19,27 @@
<% end %> -
+
<% if account.plaid_account_id.present? %> <% if Rails.env.development? %> - <%= button_to sync_plaid_item_path(account.plaid_account.plaid_item), disabled: account.syncing?, data: { turbo: false }, class: "flex items-center gap-2", title: "Sync Account" do %> - <%= lucide_icon "refresh-cw", class: "w-4 h-4 text-secondary hover:text-subdued" %> - <% end %> + <%= icon( + "refresh-cw", + as_button: true, + size: "sm", + href: sync_plaid_item_path(account.plaid_account.plaid_item), + disabled: account.syncing?, + frame: :_top + ) %> <% end %> <% else %> - <%= button_to sync_account_path(account), disabled: account.syncing?, data: { turbo: false }, class: "flex items-center gap-2", title: "Sync Account" do %> - <%= lucide_icon "refresh-cw", class: "w-4 h-4 text-secondary hover:text-subdued" %> - <% end %> + <%= icon( + "refresh-cw", + as_button: true, + size: "sm", + href: sync_account_path(account), + disabled: account.syncing?, + frame: :_top + ) %> <% end %> <%= render "accounts/show/menu", account: account %> diff --git a/app/views/assistant_messages/_assistant_message.html.erb b/app/views/assistant_messages/_assistant_message.html.erb index dfbaae07..ced5d254 100644 --- a/app/views/assistant_messages/_assistant_message.html.erb +++ b/app/views/assistant_messages/_assistant_message.html.erb @@ -5,7 +5,7 @@

Assistant reasoning

- <%= lucide_icon "chevron-down", class: "group-open:transform group-open:rotate-180 text-secondary w-5" %> + <%= icon("chevron-down", class: "group-open:transform group-open:rotate-180") %>
<%= markdown(assistant_message.content) %>
diff --git a/app/views/assistant_messages/_tool_calls.html.erb b/app/views/assistant_messages/_tool_calls.html.erb index fc0e8129..59c14922 100644 --- a/app/views/assistant_messages/_tool_calls.html.erb +++ b/app/views/assistant_messages/_tool_calls.html.erb @@ -2,7 +2,7 @@
- <%= lucide_icon "chevron-right", class: "group-open:transform group-open:rotate-90 text-secondary w-5" %> + <%= icon("chevron-right", class: "group-open:transform group-open:rotate-90") %>

Tool Calls

diff --git a/app/views/budget_categories/_budget_category_donut.html.erb b/app/views/budget_categories/_budget_category_donut.html.erb index 517135fe..0305d316 100644 --- a/app/views/budget_categories/_budget_category_donut.html.erb +++ b/app/views/budget_categories/_budget_category_donut.html.erb @@ -11,7 +11,9 @@
<% if budget_category.category.lucide_icon %> - <%= lucide_icon budget_category.category.lucide_icon, class: "w-4 h-4 shrink-0", style: "color: #{budget_category.category.color}" %> + + <%= icon(budget_category.category.lucide_icon, size: "sm", color: "current") %> + <% else %> <%= budget_category.category.name.first.upcase %> diff --git a/app/views/categories/_category.html.erb b/app/views/categories/_category.html.erb index 3dc9f9fa..ed23ce52 100644 --- a/app/views/categories/_category.html.erb +++ b/app/views/categories/_category.html.erb @@ -14,9 +14,9 @@ <% menu.with_item(variant: "link", text: t(".edit"), icon: "pencil", href: edit_category_path(category), data: { turbo_frame: :modal }) %> <% if category.transactions.any? %> - <% menu.with_item(variant: "link", text: t(".delete"), icon: "trash-2", href: new_category_deletion_path(category), data: { turbo_frame: :modal }) %> + <% menu.with_item(variant: "link", text: t(".delete"), icon: "trash-2", href: new_category_deletion_path(category), destructive: true, data: { turbo_frame: :modal }) %> <% else %> - <% menu.with_item(variant: "link", text: t(".delete"), icon: "trash-2", href: category_path(category), method: :delete) %> + <% menu.with_item(variant: "button", text: t(".delete"), icon: "trash-2", href: category_path(category), method: :delete) %> <% end %> <% end %>
diff --git a/app/views/layouts/shared/_breadcrumbs.html.erb b/app/views/layouts/shared/_breadcrumbs.html.erb index 0e2fe667..d48750dc 100644 --- a/app/views/layouts/shared/_breadcrumbs.html.erb +++ b/app/views/layouts/shared/_breadcrumbs.html.erb @@ -2,7 +2,7 @@ diff --git a/app/views/layouts/shared/_custom_confirm_dialog.html.erb b/app/views/layouts/shared/_custom_confirm_dialog.html.erb index be6dba9b..57ec7e39 100644 --- a/app/views/layouts/shared/_custom_confirm_dialog.html.erb +++ b/app/views/layouts/shared/_custom_confirm_dialog.html.erb @@ -3,12 +3,7 @@

Are you sure?

- - <%= render ButtonComponent.new( - variant: "icon", - icon: "x", - value: "cancel", - ) %> + <%= icon("x", as_button: true, value: "cancel") %>

This action cannot be undone.

diff --git a/app/views/layouts/shared/_htmldoc.html.erb b/app/views/layouts/shared/_htmldoc.html.erb index 52fc6421..c85a3a59 100644 --- a/app/views/layouts/shared/_htmldoc.html.erb +++ b/app/views/layouts/shared/_htmldoc.html.erb @@ -22,8 +22,8 @@ <% if Rails.env.development? %>
- <%= render ButtonComponent.new(variant: "icon", icon: "eclipse", data: { action: "theme#toDark" }) %> - <%= render ButtonComponent.new(variant: "icon", icon: "sun", data: { action: "theme#toLight" }) %> + <%= icon("eclipse", as_button: true, data: { action: "theme#toDark" }) %> + <%= icon("sun", as_button: true, data: { action: "theme#toLight" }) %>
<% end %> diff --git a/app/views/layouts/sidebar/_nav_item.html.erb b/app/views/layouts/sidebar/_nav_item.html.erb index dd8661af..9b50af74 100644 --- a/app/views/layouts/sidebar/_nav_item.html.erb +++ b/app/views/layouts/sidebar/_nav_item.html.erb @@ -6,7 +6,7 @@ <% icon_color = page_active?(path) ? "current" : "gray" %> <%= tag.div class: class_names("w-8 h-8 flex items-center justify-center mx-auto rounded-lg", page_active?(path) ? "bg-container shadow-xs text-primary" : "group-hover:bg-container-hover text-secondary") do %> - <%= is_custom ? icon_custom(icon_key, color: icon_color) : icon(icon_key, color: icon_color) %> + <%= icon(icon_key, color: icon_color, custom: is_custom) %> <% end %>
diff --git a/app/views/messages/_chat_form.html.erb b/app/views/messages/_chat_form.html.erb index 4dc30f06..0c536c94 100644 --- a/app/views/messages/_chat_form.html.erb +++ b/app/views/messages/_chat_form.html.erb @@ -19,11 +19,11 @@ - <%= render ButtonComponent.new(variant: "icon", icon: "arrow-up", type: "submit") %> + <%= icon("arrow-up", as_button: true, type: "submit") %>
<% end %> diff --git a/app/views/plaid_items/_plaid_item.html.erb b/app/views/plaid_items/_plaid_item.html.erb index b261085f..00cacde0 100644 --- a/app/views/plaid_items/_plaid_item.html.erb +++ b/app/views/plaid_items/_plaid_item.html.erb @@ -93,10 +93,10 @@
<% end %> <% else %> - <%= render ButtonComponent.new( - variant: "icon", - icon: "refresh-cw", - href: sync_plaid_item_path(plaid_item), + <%= icon( + "refresh-cw", + as_button: true, + href: sync_plaid_item_path(plaid_item), disabled: plaid_item.syncing? || plaid_item.scheduled_for_deletion? ) %> <% end %> diff --git a/app/views/rule/actions/_action.html.erb b/app/views/rule/actions/_action.html.erb index 0be7a8d4..2e16c55d 100644 --- a/app/views/rule/actions/_action.html.erb +++ b/app/views/rule/actions/_action.html.erb @@ -19,10 +19,9 @@ <% end %>
- <%= render ButtonComponent.new( - icon: "trash-2", - variant: "icon", - size: "sm", - data: { action: "rule--actions#remove", rule__actions_destroy_param: action.persisted? } - ) %> + <%= icon( + "trash-2", + size: "sm", + as_button: true, + data: { action: "rule--actions#remove", rule__actions_destroy_param: action.persisted? }) %> diff --git a/app/views/rule/conditions/_condition.html.erb b/app/views/rule/conditions/_condition.html.erb index fb26af8d..b79978a1 100644 --- a/app/views/rule/conditions/_condition.html.erb +++ b/app/views/rule/conditions/_condition.html.erb @@ -32,9 +32,9 @@
- <%= render ButtonComponent.new( - icon: "trash-2", - variant: "icon", + <%= icon( + "trash-2", + as_button: true, size: "sm", data: { action: "rule--conditions#remove", rule__conditions_destroy_param: condition.persisted? } ) %> diff --git a/app/views/rule/conditions/_condition_group.html.erb b/app/views/rule/conditions/_condition_group.html.erb index a5e41b68..67b3eb0f 100644 --- a/app/views/rule/conditions/_condition_group.html.erb +++ b/app/views/rule/conditions/_condition_group.html.erb @@ -19,10 +19,10 @@

of the following conditions

- <%= render ButtonComponent.new( - icon: "trash-2", - variant: "icon", + <%= icon( + "trash-2", size: "sm", + as_button: true, data: { action: "element-removal#remove" } ) %>
diff --git a/app/views/shared/_icon.html.erb b/app/views/shared/_icon.html.erb deleted file mode 100644 index 82f999de..00000000 --- a/app/views/shared/_icon.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<%# locals: (key:, size: "md", color: "current") %> - -<% size_class = case size when "sm" then "w-4 h-4" when "md" then "w-5 h-5" when "lg" then "w-6 h-6" end %> -<% color_class = case color when "current" then "text-current" when "gray" then "text-secondary" end %> - -<%= lucide_icon key, class: class_names(size_class, color_class, "shrink-0") %> diff --git a/app/views/shared/_icon_custom.html.erb b/app/views/shared/_icon_custom.html.erb deleted file mode 100644 index ae3b6935..00000000 --- a/app/views/shared/_icon_custom.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<%# locals: (key:, size: "md", color: "current") %> - -<% size_class = case size when "sm" then "w-4 h-4" when "md" then "w-5 h-5" when "lg" then "w-6 h-6" end %> -<% color_class = case color when "current" then "text-current" when "gray" then "text-secondary" end %> - -<%= inline_svg_tag "#{key}.svg", class: class_names(size_class, color_class, "shrink-0") %> diff --git a/app/views/shared/_icon_image.html.erb b/app/views/shared/_icon_image.html.erb deleted file mode 100644 index b782dc3f..00000000 --- a/app/views/shared/_icon_image.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<%# locals: (key:, size: "md", color: "current") %> - -<% size_class = case size when "sm" then "w-4 h-4" when "md" then "w-5 h-5" when "lg" then "w-6 h-6" end %> -<% color_class = case color when "current" then "text-current" when "gray" then "text-secondary" end %> - -<%= image_tag("icon-#{key}.svg", class: class_names(size_class, color_class, "shrink-0"), alt: key ) %> diff --git a/app/views/transactions/show.html.erb b/app/views/transactions/show.html.erb index ee0b12fd..501efa11 100644 --- a/app/views/transactions/show.html.erb +++ b/app/views/transactions/show.html.erb @@ -135,12 +135,14 @@

<%= t(".delete_subtitle") %>

- <%= button_to t(".delete"), - entry_path(@entry), - method: :delete, - class: "rounded-lg px-3 py-2 text-red-500 text-sm - font-medium border border-secondary", - data: { turbo_confirm: true, turbo_frame: "_top" } %> + <%= render ButtonComponent.new( + text: t(".delete"), + variant: "outline-destructive", + href: entry_path(@entry), + method: :delete, + confirm: CustomConfirm.for_resource_deletion("transaction"), + frame: "_top" + ) %>
<% end %>