app/components/blacklight/system/dropdown_component.rb in blacklight-7.38.0 vs app/components/blacklight/system/dropdown_component.rb in blacklight-7.39.0

- old
+ new

@@ -1,15 +1,12 @@ # frozen_string_literal: true module Blacklight module System - class DropdownComponent < ViewComponent::Base - renders_one :button, (lambda do |classes:, label:| - button_tag class: classes, aria: { expanded: false }, data: { toggle: 'dropdown', 'bs-toggle': 'dropdown' } do - safe_join([label, content_tag(:span, '', class: 'caret')]) - end - end) + class DropdownComponent < Blacklight::Component + renders_one :button, DropdownButtonComponent + renders_many :options, (lambda do |text:, url:, selected: false| link_to(text, url, class: "dropdown-item #{'active' if selected}", role: 'menuitem', aria: { current: ('page' if selected) }) end) # rubocop:disable Metrics/ParameterLists @@ -27,10 +24,10 @@ def button_label t(:button_label_html, default: :label_html, scope: "blacklight.search.#{@param}", @interpolation => label_for_value(@selected)) end def before_render - with_button(classes: 'btn btn-outline-secondary dropdown-toggle', label: button_label) unless button + with_button(label: button_label) unless button return if options.any? with_options(@choices.map do |option| text, value = option_text_and_value(option)