Class: Spark::Grid
- Inherits:
-
Component::Base
- Object
- ActionView::Component::Base
- Component::Base
- Spark::Grid
- Defined in:
- app/components/spark/grid.rb,
app/components/spark/grid/column.rb
Defined Under Namespace
Classes: Column
Constant Summary collapse
- COLUMN =
[1,2,3,4,6,12].freeze
- GUTTER =
%i[small base medium large xl].freeze
- ALIGN =
%i[left center right split].freeze
Instance Method Summary collapse
-
#initialize ⇒ Grid
constructor
A new instance of Grid.
Methods inherited from Component::Base
Constructor Details
#initialize ⇒ Grid
Returns a new instance of Grid.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/components/spark/grid.rb', line 19 def initialize(*) super raise "Grids do not support both cols and span. Set `span` (default span for columns), or `cols` (the number of columns per row)" if @span && @columns @gutter ||= :base if @gutter_match @span = 12 / @columns if @columns classname.base = "spark-grid" classname.add("gutter-match") if (@gutter && @gutter_match) || @column_min || @grid_min classname.add("flex-no-wrap") unless @wrap classname.add("reverse") if @reverse set_element_attribute_default(:column, span: @span) end |