Class: RevealComponent
- Defined in:
- app/components/reveal_component.rb
Overview
Reveal — hidden content revealed on hover/active.
Usage:
Reveal(type: :fade) { |c|
c.visible { Image(src: "before.jpg") }
c.hidden { Image(src: "after.jpg") }
}
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
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/components/reveal_component.rb', line 21 def to_s classes = class_names( "ui", type, (type == "move") && move_direction, { "active" => active, "instant" => instant, "disabled" => disabled }, "reveal" ) visible_el = @slots[:visible] ? tag.div(class: "visible content") { @slots[:visible] } : nil hidden_el = @slots[:hidden] ? tag.div(class: "hidden content") { @slots[:hidden] } : nil tag.div(class: classes) { safe_join([ visible_el, hidden_el, @content ]) } end |