Class: Daisy::DataDisplay::ListComponent

Inherits:
LocoMotion::BaseComponent show all
Defined in:
app/components/daisy/data_display/list_component.rb,
app/components/daisy/data_display/list_component.rb

Constant Summary

Constants inherited from LocoMotion::BaseComponent

LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS

Instance Attribute Summary collapse

Attributes inherited from LocoMotion::BaseComponent

#config, #loco_parent

Instance Method Summary collapse

Methods inherited from LocoMotion::BaseComponent

build, #component_ref, #config_option, #cssify, define_modifier, define_modifiers, define_part, define_parts, define_size, define_sizes, #empty_part_content, #inspect, #part, register_component_initializer, register_component_setup, #rendered_css, #rendered_data, #rendered_html, #rendered_stimulus_controllers, #rendered_tag_name, renders_many, renders_one, set_component_name, #set_loco_parent, #strip_spaces

Methods included from LocoMotion::Concerns::InspectableComponent

#build_inspect_string

Constructor Details

#initialize(**kws, &block) ⇒ ListComponent

Create a new List component.

Parameters:

  • kwargs (Hash)

    The keyword arguments for the component.



72
73
74
75
76
77
78
# File 'app/components/daisy/data_display/list_component.rb', line 72

def initialize(**kws, &block)
  super

  @simple_header = config_option(:header)
  @header_css = config_option(:header_css)
  @header_html = config_option(:header_html)
end

Instance Attribute Details

#header_cssString (readonly)

Returns Optional header text for the list.

Returns:

  • (String)

    Optional header text for the list



55
56
57
# File 'app/components/daisy/data_display/list_component.rb', line 55

def header_css
  @header_css
end

#header_htmlString (readonly)

Returns Optional header text for the list.

Returns:

  • (String)

    Optional header text for the list



55
56
57
# File 'app/components/daisy/data_display/list_component.rb', line 55

def header_html
  @header_html
end

#simple_headerString (readonly)

Returns Optional header text for the list.

Returns:

  • (String)

    Optional header text for the list



55
56
57
# File 'app/components/daisy/data_display/list_component.rb', line 55

def simple_header
  @simple_header
end

Instance Method Details

#before_renderObject



80
81
82
83
84
85
# File 'app/components/daisy/data_display/list_component.rb', line 80

def before_render
  add_css(:component, "list")
  set_tag_name(:component, :ul)

  with_header(tag_name: :li, css: header_css, html: header_html) { simple_header } if simple_header && !header?
end