Class: Panda::Core::Admin::BreadcrumbComponent
- Defined in:
- app/components/panda/core/admin/breadcrumb_component.rb
Overview
Breadcrumb navigation component with responsive behavior.
Shows a “Back” link on mobile and full breadcrumb trail on larger screens. Follows Tailwind UI Plus pattern for breadcrumb navigation.
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#after_template, #attrs, #before_template, #default_attrs, #merge_attrs, #tailwind_merge_attrs
Instance Method Details
#view_template ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'app/components/panda/core/admin/breadcrumb_component.rb', line 32 def view_template div do # Mobile back link if @show_back && @items.any? nav( aria: {label: "Back"}, class: "sm:hidden" ) do a( href: back_link_href, class: "flex items-center text-sm font-medium text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300" ) do render_chevron_left_icon plain "Back" end end end # Desktop breadcrumb trail nav( aria: {label: "Breadcrumb"}, class: "hidden sm:flex" ) do ol( role: "list", class: "flex items-center space-x-4" ) do @items.each_with_index do |item, index| li do if index.zero? # First item (no separator) div(class: "flex") do a( href: item[:href], class: (index) ) { item[:text] } end else # Subsequent items (with separator) div(class: "flex items-center") do render_chevron_right_icon a( href: item[:href], aria: ((index == @items.length - 1) ? {current: "page"} : nil), class: (index) ) { item[:text] } end end end end end end end end |