Class: Polaris::FiltersComponent::ItemComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Polaris::FiltersComponent::ItemComponent
- Defined in:
- app/components/polaris/filters_component.rb
Constant Summary
Constants included from ViewHelper
ViewHelper::POLARIS_HELPERS, ViewHelper::POLARIS_TEXT_STYLES
Constants included from Polaris::FetchOrFallbackHelper
Polaris::FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(label:, sectioned: true, width: nil, disabled: false, **system_arguments) ⇒ ItemComponent
constructor
A new instance of ItemComponent.
- #popover_arguments ⇒ Object
- #system_arguments ⇒ Object
Methods included from ViewHelper
#polaris_body_styles, #polaris_html_classes, #polaris_html_styles, #polaris_icon_source
Methods included from StylesListHelper
Methods included from OptionHelper
#append_option, #prepend_option
Methods included from Polaris::FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #fetch_or_fallback_nested
Methods included from ClassNameHelper
Constructor Details
#initialize(label:, sectioned: true, width: nil, disabled: false, **system_arguments) ⇒ ItemComponent
Returns a new instance of ItemComponent.
56 57 58 59 60 61 62 |
# File 'app/components/polaris/filters_component.rb', line 56 def initialize(label:, sectioned: true, width: nil, disabled: false, **system_arguments) @label = label @sectioned = sectioned @width = width @disabled = disabled @system_arguments = system_arguments end |
Instance Method Details
#call ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'app/components/polaris/filters_component.rb', line 83 def call render(Polaris::BaseComponent.new(**system_arguments)) do render(Polaris::PopoverComponent.new(**popover_arguments)) do |popover| popover.(disclosure: true, disabled: @disabled) { @label } content end end end |
#popover_arguments ⇒ Object
74 75 76 77 78 79 80 81 |
# File 'app/components/polaris/filters_component.rb', line 74 def popover_arguments { sectioned: @sectioned, style: ("width: #{@width}" if @width.present?), position: :below, alignment: :left } end |
#system_arguments ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'app/components/polaris/filters_component.rb', line 64 def system_arguments @system_arguments.tap do |opts| opts[:tag] = "div" opts[:classes] = class_names( @system_arguments[:classes], "Polaris-LegacyFilters-ConnectedFilterControl__Item" ) end end |