From 7c583a8d2e39193f782e777332bb2bdaf70066bb Mon Sep 17 00:00:00 2001 From: Cameron Dutro Date: Mon, 20 May 2024 20:45:56 -0700 Subject: [PATCH 1/2] Use the Lucide sprite instead of injecting separate SVGs onto the page --- app/components/lookbook/icon/component.html.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/components/lookbook/icon/component.html.erb b/app/components/lookbook/icon/component.html.erb index b7c7b5592..bd2833565 100644 --- a/app/components/lookbook/icon/component.html.erb +++ b/app/components/lookbook/icon/component.html.erb @@ -1,3 +1,5 @@ <%= render_component_tag :i, style: "height: #{size_rems}; width: #{size_rems}; #{@html_attrs[:style]}", class: "icon-stroke-#{stroke}" do %> - <%= svg %> -<% end %> \ No newline at end of file + + + +<% end %> From 8b4c3757d041825fbbd5ed4df1bd052540c09a78 Mon Sep 17 00:00:00 2001 From: Cameron Dutro Date: Mon, 20 May 2024 21:44:06 -0700 Subject: [PATCH 2/2] Remove unnecessary icon component methods --- app/components/lookbook/icon/component.rb | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/app/components/lookbook/icon/component.rb b/app/components/lookbook/icon/component.rb index 70b043b44..3add00981 100644 --- a/app/components/lookbook/icon/component.rb +++ b/app/components/lookbook/icon/component.rb @@ -14,21 +14,5 @@ def initialize(name:, size: 4, stroke: 2, **html_attrs) def size_rems "#{@size * 0.25}rem" end - - def svg - ICON_CACHE[@icon_name] ||= read_svg - end - - def read_svg - File.read(svg_path).html_safe - rescue - if Rails.env.development? || Rails.env.test? - raise "`#{@icon_name}` is not a valid icon name" - end - end - - def svg_path - Lookbook::Engine.root.join("assets/icons/#{@icon_name}.svg") - end end end