Class: UI::SheetContent
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::SheetContent
- Includes:
- SheetContentBehavior
- Defined in:
- app/components/ui/sheet_content.rb
Constant Summary
Constants included from SheetContentBehavior
UI::SheetContentBehavior::SIDES
Instance Method Summary collapse
-
#initialize(side: "right", open: false, show_close: true, classes: nil, **attributes) ⇒ SheetContent
constructor
A new instance of SheetContent.
- #view_template(&block) ⇒ Object
Methods included from SheetContentBehavior
#merged_sheet_content_data_attributes, #sheet_content_base_classes, #sheet_content_classes, #sheet_content_close_button_classes, #sheet_content_data_attributes, #sheet_content_html_attributes, #sheet_content_side_classes
Constructor Details
#initialize(side: "right", open: false, show_close: true, classes: nil, **attributes) ⇒ SheetContent
Returns a new instance of SheetContent.
10 11 12 13 14 15 16 |
# File 'app/components/ui/sheet_content.rb', line 10 def initialize(side: "right", open: false, show_close: true, classes: nil, **attributes) @side = side @open = open @show_close = show_close @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/ui/sheet_content.rb', line 18 def view_template(&block) div(**sheet_content_html_attributes) do yield if block_given? # Built-in close button (like shadcn) if @show_close ( class: , data: {action: "click->ui--dialog#close"} ) do render_x_icon span(class: "sr-only") { "Close" } end end end end |