Module: Components::SheetHelper
- Defined in:
- app/helpers/components/sheet_helper.rb
Instance Method Summary collapse
- #direction_class(direction) ⇒ Object
- #render_sheet(**options, &block) ⇒ Object
- #sheet_content(&block) ⇒ Object
- #sheet_trigger(&block) ⇒ Object
Instance Method Details
#direction_class(direction) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/helpers/components/sheet_helper.rb', line 22 def direction_class(direction) mappings = { left: "left-0", right: "right-0" } mappings[direction.to_sym] end |
#render_sheet(**options, &block) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'app/helpers/components/sheet_helper.rb', line 2 def render_sheet(**, &block) [:direction] ||= "left" [:width] ||= "w-3/4" [:state] ||= "closed" content_for :sheet_trigger, "", flush: true content_for :sheet_content, "", flush: true content = capture(&block) if block render "components/ui/sheet", content: content, options: end |
#sheet_content(&block) ⇒ Object
18 19 20 |
# File 'app/helpers/components/sheet_helper.rb', line 18 def sheet_content(&block) content_for :sheet_content, capture(&block), flush: true end |
#sheet_trigger(&block) ⇒ Object
14 15 16 |
# File 'app/helpers/components/sheet_helper.rb', line 14 def sheet_trigger(&block) content_for :sheet_trigger, capture(&block), flush: true end |