Class: Polaris::ButtonGroupComponent::ButtonGroupItemButtonComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/polaris/button_group_component.rb

Constant Summary

Constants included from ViewHelper

ViewHelper::POLARIS_HELPERS, ViewHelper::POLARIS_TEXT_STYLES

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ViewHelper

#polaris_body_styles, #polaris_html_classes, #polaris_html_styles, #polaris_icon_source

Methods included from StylesListHelper

#styles_list

Methods included from OptionHelper

#append_option, #prepend_option

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #fetch_or_fallback_nested

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(position:, **system_arguments) ⇒ ButtonGroupItemButtonComponent

Returns a new instance of ButtonGroupItemButtonComponent.



71
72
73
74
75
76
77
78
79
80
81
# File 'app/components/polaris/button_group_component.rb', line 71

def initialize(position:, **system_arguments)
  @position = position

  @system_arguments = system_arguments
  @system_arguments[:tag] = :div
  @system_arguments[:classes] = class_names(
    @system_arguments[:classes],
    "Polaris-ButtonGroup__Item",
    "Polaris-ButtonGroup__Item--plain": system_arguments.key?(:plain)
  )
end

Instance Attribute Details

#positionObject (readonly)

Returns the value of attribute position.



69
70
71
# File 'app/components/polaris/button_group_component.rb', line 69

def position
  @position
end

Instance Method Details

#callObject



83
84
85
86
87
88
89
# File 'app/components/polaris/button_group_component.rb', line 83

def call
  button_arguments = @system_arguments.except(:classes, :tag)

  render(Polaris::BaseComponent.new(tag: @system_arguments[:tag], classes: @system_arguments[:classes])) do
    render(Polaris::ButtonComponent.new(**button_arguments)) { button_arguments[:content] || content }
  end
end