Class: HakumiComponents::Anchor::Link::Component

Inherits:
BaseComponent
  • Object
show all
Extended by:
T::Sig
Defined in:
app/components/hakumi_components/anchor/link/component.rb

Constant Summary

Constants inherited from BaseComponent

BaseComponent::ControllerOptions, BaseComponent::DateInput, BaseComponent::DateLikeValue, BaseComponent::DimensionInput, BaseComponent::HtmlPayloadInput, BaseComponent::I18nOptionValue, BaseComponent::PresenceArray, BaseComponent::PresenceScalar, BaseComponent::PresenceValue, BaseComponent::RawHtmlInput, BaseComponent::SIZES, BaseComponent::SizeValue, BaseComponent::SymbolInput

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseComponent

#append_data_token, boolean_html_param, #build_inline_style, cast_boolean, #cast_boolean, #class_names, #component_classes, #data_attributes_from, #dimension_to_css, #ensure_dom_id!, float_html_param, #generate_id, #html_classes, html_param, html_primitive_param, #html_style, #i18n_scope, integer_html_param, #merge_attributes, #render_value, #size_to_pixels, #stimulus_attrs, string_html_param, string_or_symbol_array_html_param, symbol_html_param, #t_default, #translate_with_default, #validate_inclusion!, #validate_required!, #value_present?

Constructor Details

#initialize(href:, title:, target: nil, **html_options) ⇒ Component

Returns a new instance of Component.



20
21
22
23
24
25
# File 'app/components/hakumi_components/anchor/link/component.rb', line 20

def initialize(href:, title:, target: nil, **html_options)
  @href = T.let(href, String)
  @title = T.let(title, String)
  @target = T.let(target, T.nilable(String))
  @html_options = T.let(html_options, Types::HtmlAttributes)
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



28
29
30
# File 'app/components/hakumi_components/anchor/link/component.rb', line 28

def href
  @href
end

#targetObject (readonly)

Returns the value of attribute target.



34
35
36
# File 'app/components/hakumi_components/anchor/link/component.rb', line 34

def target
  @target
end

#titleObject (readonly)

Returns the value of attribute title.



31
32
33
# File 'app/components/hakumi_components/anchor/link/component.rb', line 31

def title
  @title
end

Instance Method Details

#children?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'app/components/hakumi_components/anchor/link/component.rb', line 47

def children?
  links.any?
end


37
38
39
# File 'app/components/hakumi_components/anchor/link/component.rb', line 37

def link_classes
  "hakumi-anchor-link"
end

#title_classesObject



42
43
44
# File 'app/components/hakumi_components/anchor/link/component.rb', line 42

def title_classes
  "hakumi-anchor-link-title"
end