Class: Daisy::DataDisplay::CountdownComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::DataDisplay::CountdownComponent
- Includes:
- LocoMotion::Concerns::TippableComponent
- Defined in:
- app/components/daisy/data_display/countdown_component.rb
Overview
The Countdown component displays a timer that counts down to or up from a specific duration. It can show days, hours, minutes, and seconds with customizable separators and formats.
Includes the LocoMotion::Concerns::TippableComponent module to enable easy tooltip addition.
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) ⇒ CountdownComponent
constructor
Creates a new countdown component.
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) ⇒ CountdownComponent
Creates a new countdown component.
59 60 61 62 63 64 65 66 |
# File 'app/components/daisy/data_display/countdown_component.rb', line 59 def initialize(*args, **kws, &block) super @duration = config_option(:duration, args[0]) @separator = config_option(:separator, ":") @parts_css = config_option(:parts_css) @parts_html = config_option(:parts_html) end |
Instance Method Details
#before_render ⇒ Object
68 69 70 71 |
# File 'app/components/daisy/data_display/countdown_component.rb', line 68 def before_render setup_component # Configure countdown parts and stimulus super # Run TippableComponent hook end |