Class: UI::SheetComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::SheetComponent
- Includes:
- SheetBehavior
- Defined in:
- app/view_components/ui/sheet_component.rb
Overview
Sheet container component (ViewComponent) A panel that slides in from the edge of the screen
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(open: false, close_on_escape: true, close_on_overlay_click: true, classes: "", **attributes) ⇒ SheetComponent
constructor
A new instance of SheetComponent.
Methods included from SheetBehavior
#merged_sheet_data_attributes, #sheet_base_classes, #sheet_classes, #sheet_data_attributes, #sheet_html_attributes
Constructor Details
#initialize(open: false, close_on_escape: true, close_on_overlay_click: true, classes: "", **attributes) ⇒ SheetComponent
Returns a new instance of SheetComponent.
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/view_components/ui/sheet_component.rb', line 30 def initialize( open: false, close_on_escape: true, close_on_overlay_click: true, classes: "", **attributes ) @open = open @close_on_escape = close_on_escape @close_on_overlay_click = @classes = classes @attributes = attributes end |
Instance Method Details
#call ⇒ Object
44 45 46 47 48 49 |
# File 'app/view_components/ui/sheet_component.rb', line 44 def call attrs = sheet_html_attributes attrs[:data] = attrs[:data].merge(@attributes.fetch(:data, {})) content_tag :div, content, **attrs.merge(@attributes.except(:data)) end |