Class: Railsboot::ContainerComponent
- Defined in:
- app/components/railsboot/container_component.rb
Constant Summary collapse
- BREAKPOINTS =
["sm", "md", "lg", "xl", "xxl"].freeze
- DEFAULT_BREAKPOINT =
"".freeze
Constants inherited from Component
Railsboot::Component::COLORS, Railsboot::Component::DEFAULT_COLOR
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(breakpoint: DEFAULT_BREAKPOINT, fluid: false, **html_attributes) ⇒ ContainerComponent
constructor
A new instance of ContainerComponent.
Constructor Details
#initialize(breakpoint: DEFAULT_BREAKPOINT, fluid: false, **html_attributes) ⇒ ContainerComponent
Returns a new instance of ContainerComponent.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/components/railsboot/container_component.rb', line 5 def initialize(breakpoint: DEFAULT_BREAKPOINT, fluid: false, **html_attributes) @breakpoint = breakpoint @fluid = fluid @html_attributes = html_attributes @html_attributes[:class] = class_names( ("container-#{breakpoint}" if @breakpoint.in?(BREAKPOINTS)), ("container-fluid" if @fluid), ("container" if @fluid.blank? && !@breakpoint.in?(BREAKPOINTS)), html_attributes.delete(:class) ) end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 |
# File 'app/components/railsboot/container_component.rb', line 18 def call render Railsboot::BaseComponent.new(tag: "div", **@html_attributes) do content end end |