Class: Daisy::Mockup::DeviceComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::Mockup::DeviceComponent
- Defined in:
- app/components/daisy/mockup/device_component.rb
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
Sets up the component’s CSS classes.
-
#call ⇒ Object
Renders the device with its camera (if enabled) and display content.
-
#initialize(**kws) ⇒ DeviceComponent
constructor
Creates a new Device 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
Methods included from LocoMotion::Concerns::InspectableComponent
Constructor Details
#initialize(**kws) ⇒ DeviceComponent
Creates a new Device component.
54 55 56 57 58 |
# File 'app/components/daisy/mockup/device_component.rb', line 54 def initialize(**kws) super(**kws) @show_camera = config_option(:show_camera, true) end |
Instance Method Details
#before_render ⇒ Object
Sets up the component’s CSS classes.
63 64 65 66 |
# File 'app/components/daisy/mockup/device_component.rb', line 63 def before_render add_css(:camera, "mockup-phone-camera") add_css(:display, "mockup-phone-display") end |
#call ⇒ Object
Renders the device with its camera (if enabled) and display content.
71 72 73 74 75 76 77 78 79 |
# File 'app/components/daisy/mockup/device_component.rb', line 71 def call part(:component) do concat(part(:camera)) if @show_camera concat(part(:display) do content end) end end |