Class: Daisy::DataDisplay::TimelineEventComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::DataDisplay::TimelineEventComponent
- Defined in:
- app/components/daisy/data_display/timeline_event_component.rb
Overview
The middle and middle_icon options are mutually exclusive. If both are provided, middle takes precedence.
A component for rendering individual events within a timeline. Each event can have three sections: start (typically a date or time), middle (an icon or marker), and end (the event description).
Constant Summary
Constants inherited from LocoMotion::BaseComponent
LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS
Instance Attribute Summary
Attributes inherited from LocoMotion::BaseComponent
Instance Method Summary collapse
- #before_render ⇒ Object
-
#initialize(*args, **kws, &block) ⇒ TimelineEventComponent
constructor
Creates a new timeline event component.
- #set_event_index(index) ⇒ Object
- #set_events_length(length) ⇒ Object
- #setup_parts ⇒ Object
- #setup_separator ⇒ Object
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
Constructor Details
#initialize(*args, **kws, &block) ⇒ TimelineEventComponent
Creates a new timeline event component.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/components/daisy/data_display/timeline_event_component.rb', line 49 def initialize(*args, **kws, &block) super(*args, **kws, &block) @event_index = nil @events_length = nil @simple_start = config_option(:start) @simple_middle = config_option(:middle) @simple_middle_icon = config_option(:middle_icon) @simple_end = config_option(:end) end |
Instance Method Details
#before_render ⇒ Object
61 62 63 64 65 66 |
# File 'app/components/daisy/data_display/timeline_event_component.rb', line 61 def before_render set_tag_name(:component, :li) setup_parts setup_separator end |
#set_event_index(index) ⇒ Object
78 79 80 |
# File 'app/components/daisy/data_display/timeline_event_component.rb', line 78 def set_event_index(index) @event_index = index end |
#set_events_length(length) ⇒ Object
82 83 84 |
# File 'app/components/daisy/data_display/timeline_event_component.rb', line 82 def set_events_length(length) @events_length = length end |
#setup_parts ⇒ Object
68 69 70 71 72 |
# File 'app/components/daisy/data_display/timeline_event_component.rb', line 68 def setup_parts add_css(:start, "timeline-start") add_css(:middle, "timeline-middle") add_css(:end, "timeline-end") end |
#setup_separator ⇒ Object
74 75 76 |
# File 'app/components/daisy/data_display/timeline_event_component.rb', line 74 def setup_separator set_tag_name(:separator, :hr) end |