Class: PlaceholderComponent
- Defined in:
- app/components/placeholder_component.rb
Overview
Placeholder — skeleton/placeholder content while loading.
Usage:
Placeholder { |c|
c.header_slot {
text '<div class="line"></div><div class="line"></div>'.html_safe
}
c.paragraph {
text '<div class="line"></div><div class="line"></div>'.html_safe
}
}
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
Methods inherited from Component
default, #initialize, #render_in, slot
Constructor Details
This class inherits a constructor from Component
Instance Method Details
#to_s ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/components/placeholder_component.rb', line 23 def to_s classes = class_names( "ui", { "fluid" => fluid, "inverted" => inverted }, "placeholder" ) header_el = @slots[:header_slot] ? tag.div(class: "header") { @slots[:header_slot] } : nil para_el = @slots[:paragraph] ? tag.div(class: "paragraph") { @slots[:paragraph] } : nil image_el = @slots[:image_slot] ? tag.div(class: "image") { @slots[:image_slot] } : nil tag.div(class: classes) { safe_join([ header_el, para_el, image_el, @content.presence ]) } end |