diff --git a/admin/app/components/solidus_admin/ui/panel/component.html.erb b/admin/app/components/solidus_admin/ui/panel/component.html.erb index 041c3e95ea1..71c968b99be 100644 --- a/admin/app/components/solidus_admin/ui/panel/component.html.erb +++ b/admin/app/components/solidus_admin/ui/panel/component.html.erb @@ -22,29 +22,18 @@ <% end %> <% if @title %> -
+ <%= render_section do %>

<%= @title %> <%= render component("ui/toggletip").new(text: @title_hint) if @title_hint %>

-
+ <% end %> <% end %> <% sections.each do |section| %> <%= section %> <% end %> - <% if content.present? %> -
- <%= content %> -
- <% end %> - - <% if action? %> -
-
- <%= action %> -
-
- <% end %> + <%= render_section { content } if content.present? %> + <%= render_section { tag.div(action, class: "flex justify-between items-center") } if action? %> diff --git a/admin/app/components/solidus_admin/ui/panel/component.rb b/admin/app/components/solidus_admin/ui/panel/component.rb index b2f353eca07..97b8c446a42 100644 --- a/admin/app/components/solidus_admin/ui/panel/component.rb +++ b/admin/app/components/solidus_admin/ui/panel/component.rb @@ -10,13 +10,8 @@ class SolidusAdmin::UI::Panel::Component < SolidusAdmin::BaseComponent ) } - renders_many :sections, ->(wide: false, high: false, **args, &block) do - tag.section(**args, class: " - border-gray-100 border-t w-full first-of-type:border-t-0 - #{'px-6' unless wide} - #{'py-6' unless high} - #{args[:class]} - ", &block) + renders_many :sections, ->(**args, &block) do + render_section(**args, &block) end renders_many :menus, ->(name, url, **args) do @@ -33,4 +28,13 @@ def initialize(title: nil, title_hint: nil) @title = title @title_hint = title_hint end + + def render_section(wide: false, high: false, **args, &block) + tag.section(**args, class: " + border-gray-100 border-t w-full first-of-type:border-t-0 + #{'px-6' unless wide} + #{'py-6' unless high} + #{args[:class]} + ", &block) + end end