Use icon helper for all-the-things #2191

Merged
ahatzz11 merged 4 commits from icon-helper-all-the-things into main 2025-05-07 00:08:18 +08:00
ahatzz11 commented 2025-05-02 22:34:43 +08:00 (Migrated from github.com)

While pulling in changes from #2154 into #2177 I noticed there were some places that were using the lucide_icon helper instead of the new icon helper. This PR moves the rest of these over. Unfortunately searching for lucide_icon still returns a bunch of results because of the field name on a Category, but I am pretty confident I got the rest of these.

While pulling in changes from #2154 into #2177 I noticed there were some places that were using the lucide_icon helper instead of the new icon helper. This PR moves the rest of these over. Unfortunately searching for `lucide_icon` still returns a bunch of results because of the field name on a `Category`, but I am pretty confident I got the rest of these.
ahatzz11 (Migrated from github.com) reviewed 2025-05-02 22:37:26 +08:00
@@ -1,6 +1,7 @@
<%= link_to href, **merged_opts do %>
ahatzz11 (Migrated from github.com) commented 2025-05-02 22:37:25 +08:00

Is this helpers.icon() the right way of doing this? It seems like anything outside of the view doesn't have access to icon directly, but not super familiar with the ruby scoping here.

Is this `helpers.icon()` the right way of doing this? It seems like anything outside of the view doesn't have access to `icon` directly, but not super familiar with the ruby scoping here.
zachgoll (Migrated from github.com) reviewed 2025-05-06 00:21:43 +08:00
@@ -1,6 +1,7 @@
<%= link_to href, **merged_opts do %>
zachgoll (Migrated from github.com) commented 2025-05-06 00:21:42 +08:00

Yep, helpers.icon is the correct way!

Yep, `helpers.icon` is the correct way!
zachgoll (Migrated from github.com) reviewed 2025-05-06 00:24:52 +08:00
@@ -1,6 +1,6 @@
<%= container do %>
zachgoll (Migrated from github.com) commented 2025-05-06 00:24:51 +08:00

I think we may need to double-check both this button_component and link_component to make sure the classes we're passing through don't introduce any conflicts. I think maybe the ideal solution is that our components pass through valid opts to the icon helper, such as:

<%= helpers.icon(icon, size: size, color: choose_based_on_variant_fn) %>

That would also allow us to remove these icon dimensions from the buttonish_component.rb config and just use the sizes that the icon helper defines:

441f436187/app/components/buttonish_component.rb (L43)

I think we may need to double-check both this `button_component` and `link_component` to make sure the classes we're passing through don't introduce any conflicts. I think maybe the ideal solution is that our components pass through valid opts to the icon helper, such as: ```erb <%= helpers.icon(icon, size: size, color: choose_based_on_variant_fn) %> ``` That would also allow us to _remove_ these icon dimensions from the `buttonish_component.rb` config and just use the sizes that the icon helper defines: https://github.com/maybe-finance/maybe/blob/441f436187231ae4a0a696d353dcb38bbbf1eed0/app/components/buttonish_component.rb#L43
zachgoll (Migrated from github.com) reviewed 2025-05-06 00:25:17 +08:00
zachgoll (Migrated from github.com) left a comment

Other than the quick check on our "Buttonish" components, all looks good!

Other than the quick check on our "Buttonish" components, all looks good!
ahatzz11 (Migrated from github.com) reviewed 2025-05-06 01:49:52 +08:00
@@ -1,6 +1,6 @@
<%= container do %>
ahatzz11 (Migrated from github.com) commented 2025-05-06 01:49:52 +08:00

Good feedback, thanks! I think I've implemented what you were looking for now. In theory we could have some kind of separate icon_size on the buttonish components, but I kind of like that icon size being tied to the size of the button itself, which should help ensure nice dimensions too. Let me know if my update wasn't quite what you were looking for.

I did a spot check on various screens between prod and local and everything seems to be behaving the same way!

Good feedback, thanks! I think I've implemented what you were looking for now. In theory we could have some kind of separate `icon_size` on the buttonish components, but I kind of like that icon size being tied to the size of the button itself, which should help ensure nice dimensions too. Let me know if my update wasn't quite what you were looking for. I did a spot check on various screens between prod and local and everything seems to be behaving the same way!
zachgoll (Migrated from github.com) approved these changes 2025-05-07 00:08:11 +08:00
zachgoll (Migrated from github.com) left a comment

Yep, that's what I was thinking!

Yep, that's what I was thinking!
Sign in to join this conversation.