Class: GovukComponent::PhaseBannerComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/govuk_component/phase_banner_component.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#html_attributes

Attributes included from Traits::CustomHtmlAttributes

#html_attributes

Instance Method Summary collapse

Methods included from Traits::CustomClasses

#classes

Methods included from Govuk::Components::Helpers::CssUtilities

#combine_classes

Constructor Details

#initialize(tag: nil, text: nil, classes: [], html_attributes: {}) ⇒ PhaseBannerComponent

Returns a new instance of PhaseBannerComponent.



4
5
6
7
8
9
# File 'app/components/govuk_component/phase_banner_component.rb', line 4

def initialize(tag: nil, text: nil, classes: [], html_attributes: {})
  super(classes: classes, html_attributes: html_attributes)

  @phase_tag = tag
  @text      = text
end

Instance Attribute Details

#phase_tagObject (readonly)

Returns the value of attribute phase_tag.



2
3
4
# File 'app/components/govuk_component/phase_banner_component.rb', line 2

def phase_tag
  @phase_tag
end

#textObject (readonly)

Returns the value of attribute text.



2
3
4
# File 'app/components/govuk_component/phase_banner_component.rb', line 2

def text
  @text
end

Instance Method Details

#phase_tag_componentObject



11
12
13
# File 'app/components/govuk_component/phase_banner_component.rb', line 11

def phase_tag_component
  GovukComponent::TagComponent.new(classes: "govuk-phase-banner__content__tag", **phase_tag)
end