Class: StickyComponent
- Defined in:
- app/components/sticky_component.rb
Overview
Sticky — sticky/fixed position elements that follow scroll.
Usage:
Sticky { text "I stick on scroll" }
Sticky(offset: 50, pushing: true) { text "Sticky header" }
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
14 15 16 17 18 19 20 21 |
# File 'app/components/sticky_component.rb', line 14 def to_s data = { controller: "fui-sticky" } data[:fui_sticky_context_value] = context if context data[:fui_sticky_pushing_value] = "true" if pushing data[:fui_sticky_offset_value] = offset if offset > 0 tag.div(class: "ui sticky", data: data) { @content } end |