Class: Daisy::DataDisplay::StatusComponent

Inherits:
LocoMotion::BaseComponent show all
Includes:
LocoMotion::Concerns::TippableComponent
Defined in:
app/components/daisy/data_display/status_component.rb

Overview

The Status component displays a small icon to visually show the current status of an element, such as online, offline, error, etc. It follows the DaisyUI status component pattern.

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

#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) ⇒ StatusComponent

Creates a new status component.

rubocop:disable Lint/UselessMethodDefinition

Parameters:

  • kws (Hash)

    The keyword arguments for the component.

Options Hash (**kws):

  • :tip (String)

    The tooltip text to display when hovering over the component.



46
47
48
# File 'app/components/daisy/data_display/status_component.rb', line 46

def initialize(**kws, &block)
  super
end

Instance Method Details

#before_renderObject

rubocop:enable Lint/UselessMethodDefinition



51
52
53
54
# File 'app/components/daisy/data_display/status_component.rb', line 51

def before_render
  setup_component
  super # Call super after setup
end

#callObject



56
57
58
# File 'app/components/daisy/data_display/status_component.rb', line 56

def call
  part(:component)
end