Class: Daisy::Mockup::FrameComponent

Inherits:
LocoMotion::BaseComponent show all
Defined in:
app/components/daisy/mockup/frame_component.rb

Overview

The FrameComponent creates a simple window-like container for showcasing content. Similar to the BrowserComponent but without the toolbar, it's perfect for:

  • Displaying application screenshots.
  • Creating simple window mockups.
  • Framing content in presentations.
  • Building marketing materials.

The component provides a clean, minimal window frame that can be styled to match your design needs.

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) ⇒ FrameComponent

Creates a new Frame component.

rubocop:disable Lint/UselessMethodDefinition -- exists so the doc comment above has a real method to attach to; FrameComponent has no options of its own beyond the universal ones documented here.

Parameters:

  • kws (Hash)

    a customizable set of options

Options Hash (**kws):

  • css (String)

    Additional CSS classes for styling. Common options include:

    • Size: w-full, max-w-4xl
    • Border: border, border-primary
    • Background: bg-base-100, bg-primary
    • Shadow: shadow-lg, shadow-xl


50
51
52
# File 'app/components/daisy/mockup/frame_component.rb', line 50

def initialize(**kws)
  super(**kws)
end

Instance Method Details

#before_renderObject

Sets up the component's CSS classes.



58
59
60
# File 'app/components/daisy/mockup/frame_component.rb', line 58

def before_render
  add_css(:component, "mockup-window")
end

#callObject

Renders the frame with its content.



65
66
67
68
69
# File 'app/components/daisy/mockup/frame_component.rb', line 65

def call
  part(:component) do
    content
  end
end