From dc790d7662a1740213fdb3e9185f3f9b44b183c6 Mon Sep 17 00:00:00 2001 From: neo773 Date: Mon, 14 Apr 2025 22:57:43 +0530 Subject: [PATCH] WIP --- app/assets/images/icon-assistant.svg | 20 +++++++++++++------- app/helpers/application_helper.rb | 4 ++-- app/views/layouts/application.html.erb | 2 +- app/views/layouts/sidebar/_nav_item.html.erb | 2 +- app/views/shared/_icon_custom.html.erb | 6 ++++++ 5 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 app/views/shared/_icon_custom.html.erb diff --git a/app/assets/images/icon-assistant.svg b/app/assets/images/icon-assistant.svg index 1e4e7d2a..7ba1299f 100644 --- a/app/assets/images/icon-assistant.svg +++ b/app/assets/images/icon-assistant.svg @@ -1,25 +1,31 @@ - + + fill="currentColor" /> + fill="currentColor" /> + fill="currentColor" /> + stroke="currentColor" stroke-width="0.3" stroke-linecap="round" /> + stroke="currentColor" stroke-width="0.3" stroke-linecap="round" /> + stroke="currentColor" stroke-width="0.3" stroke-linecap="round" /> + diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9f457c7b..64321595 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5,8 +5,8 @@ module ApplicationHelper render partial: "shared/icon", locals: { key:, size:, color: } end - def icon_image(key, size: "md", color: "current") - render partial: "shared/icon_image", locals: { key:, size:, color: } + def icon_custom(key, size: "md", color: "current") + render partial: "shared/icon_custom", locals: { key:, size:, color: } end # Convert alpha (0-1) to 8-digit hex (00-FF) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2487dcfb..b61c6588 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -125,7 +125,7 @@
  • - <%= render "layouts/sidebar/nav_item", name: "Assistant", path: chats_path, icon_key: "assistant", is_custom: true %> + <%= render "layouts/sidebar/nav_item", name: "Assistant", path: chats_path, icon_key: "icon-assistant", is_custom: true %>
  • diff --git a/app/views/layouts/sidebar/_nav_item.html.erb b/app/views/layouts/sidebar/_nav_item.html.erb index 779e5f9d..6b7dd382 100644 --- a/app/views/layouts/sidebar/_nav_item.html.erb +++ b/app/views/layouts/sidebar/_nav_item.html.erb @@ -7,7 +7,7 @@ <%= tag.div class: class_names("w-4 h-1 lg:w-1 lg:h-4 rounded-bl-sm rounded-br-sm lg:rounded-tr-sm lg:rounded-br-sm lg:rounded-bl-none", "bg-white md:bg-container-inset" => page_active?(path)) %> <%= tag.div class: class_names("w-8 h-8 flex items-center justify-center mx-auto rounded-lg", page_active?(path) ? "bg-white md:bg-container-inset shadow-xs text-primary" : "group-hover:bg-white-hover md:group-hover:bg-container-inset-hover text-secondary") do %> - <%= is_custom ? icon_image(icon_key) : icon(icon_key) %> + <%= is_custom ? icon_custom(icon_key) : icon(icon_key) %> <% end %> diff --git a/app/views/shared/_icon_custom.html.erb b/app/views/shared/_icon_custom.html.erb new file mode 100644 index 00000000..ae3b6935 --- /dev/null +++ b/app/views/shared/_icon_custom.html.erb @@ -0,0 +1,6 @@ +<%# 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") %>