Class: DesignSystem::Generic::InsetTextComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- DesignSystem::Generic::InsetTextComponent
- Defined in:
- app/components/design_system/generic/inset_text_component.rb
Overview
Inset text used to differentiate a block of content from what surrounds
it, rendered by ds_inset_text. Content comes from the text argument or
a block (block wins if both are given). Renders nothing when blank.
Direct Known Subclasses
DesignSystem::Govuk::InsetTextComponent, Nhsuk::InsetTextComponent
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text: nil, **options) ⇒ InsetTextComponent
constructor
A new instance of InsetTextComponent.
- #inset_options ⇒ Object
- #render? ⇒ Boolean
Methods included from Helpers::CssHelper
Methods included from BrandDerivable
Constructor Details
#initialize(text: nil, **options) ⇒ InsetTextComponent
Returns a new instance of InsetTextComponent.
7 8 9 10 11 |
# File 'app/components/design_system/generic/inset_text_component.rb', line 7 def initialize(text: nil, **) super() @text = text @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'app/components/design_system/generic/inset_text_component.rb', line 13 def @options end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
13 14 15 |
# File 'app/components/design_system/generic/inset_text_component.rb', line 13 def text @text end |
Instance Method Details
#inset_options ⇒ Object
19 20 21 |
# File 'app/components/design_system/generic/inset_text_component.rb', line 19 def (, ["#{brand}-inset-text"]) end |
#render? ⇒ Boolean
15 16 17 |
# File 'app/components/design_system/generic/inset_text_component.rb', line 15 def render? text.present? || content.present? end |