Class: Primer::OpenProject::SubHeader::Button
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Primer::OpenProject::SubHeader::Button
- Defined in:
- app/components/primer/open_project/sub_header/button.rb
Overview
A Helper class to create a Button with required icon inside the SubHeader action slot Do not use standalone
Constant Summary
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
- #before_render ⇒ Object
- #call ⇒ Object
-
#initialize(icon:, **system_arguments) ⇒ Button
constructor
A new instance of Button.
Methods inherited from Component
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Methods included from AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
Instance Method Details
#before_render ⇒ Object
28 29 30 31 32 33 |
# File 'app/components/primer/open_project/sub_header/button.rb', line 28 def before_render if leading_visual_icon.present? raise ArgumentError, "Do not use the leading_visual_icon slot within the SubHeader, as it is reserved. Instead provide a leading_icon within the subHeader button slot" end end |
#call ⇒ Object
35 36 37 38 39 40 |
# File 'app/components/primer/open_project/sub_header/button.rb', line 35 def call render(@button) do || .with_leading_visual_icon(icon: @icon) content end end |