Class: Railsboot::OffcanvasComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::OffcanvasComponent
- Defined in:
- app/components/railsboot/offcanvas_component.rb
Overview
ViewComponent: renders the offcanvas block.
Constant Summary collapse
- PLACEMENTS =
Placements.
%w[start end top bottom].freeze
- DEFAULT_PLACEMENT =
Default placement.
"start".freeze
Instance Method Summary collapse
-
#initialize(placement: DEFAULT_PLACEMENT, **html_attributes) ⇒ OffcanvasComponent
constructor
A new instance of OffcanvasComponent.
Constructor Details
#initialize(placement: DEFAULT_PLACEMENT, **html_attributes) ⇒ OffcanvasComponent
Returns a new instance of OffcanvasComponent.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/components/railsboot/offcanvas_component.rb', line 12 def initialize(placement: DEFAULT_PLACEMENT, **html_attributes) @placement = fetch_or_fallback(placement, PLACEMENTS, DEFAULT_PLACEMENT) @html_attributes = html_attributes @html_attributes[:tag] = "div" @html_attributes[:class] = class_names( "offcanvas", "offcanvas-#{@placement}", html_attributes.delete(:class) ) end |