Class: DesignSystem::Generic::GridComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- DesignSystem::Generic::GridComponent
- Defined in:
- app/components/design_system/generic/grid_component.rb
Overview
Grid row rendered by ds_grid. Wraps columns whose widths map to the brand grid-column classes. The column widths are validated (total must not exceed 100%) when the component is built.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#grid ⇒ Object
readonly
Returns the value of attribute grid.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #column_options(column) ⇒ Object
-
#initialize(grid:, **options) ⇒ GridComponent
constructor
A new instance of GridComponent.
- #row_options ⇒ Object
Methods included from Helpers::CssHelper
Methods included from BrandDerivable
Constructor Details
#initialize(grid:, **options) ⇒ GridComponent
Returns a new instance of GridComponent.
7 8 9 10 11 12 |
# File 'app/components/design_system/generic/grid_component.rb', line 7 def initialize(grid:, **) super() @grid = grid @options = @grid.validate_total_width! end |
Instance Attribute Details
#grid ⇒ Object (readonly)
Returns the value of attribute grid.
14 15 16 |
# File 'app/components/design_system/generic/grid_component.rb', line 14 def grid @grid end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
14 15 16 |
# File 'app/components/design_system/generic/grid_component.rb', line 14 def @options end |
Instance Method Details
#column_options(column) ⇒ Object
20 21 22 |
# File 'app/components/design_system/generic/grid_component.rb', line 20 def (column) (column[:options].dup, [grid_class(column[:width])]) end |
#row_options ⇒ Object
16 17 18 |
# File 'app/components/design_system/generic/grid_component.rb', line 16 def (, ["#{brand}-grid-row"]) end |