Class: ColumnComponent
- Defined in:
- app/components/column_component.rb
Overview
Column — grid column with responsive width support.
Usage:
Grid(stackable: true) {
Column(width: 4) { text "Four wide" }
Column(computer: 8, tablet: 16) { text "Responsive" }
Column(computer: 4, tablet: 8, mobile: 16, aligned: "center") { text "All breakpoints" }
}
Constant Summary collapse
- NUMBERS =
%w[one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen].freeze
Constants inherited from Component
Instance Method Summary collapse
Methods inherited from Component
default, #initialize, #render_in, slot
Constructor Details
This class inherits a constructor from Component
Instance Method Details
#to_s ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/components/column_component.rb', line 26 def to_s # Cannot use class_names here — it deduplicates tokens, which breaks # responsive widths where "wide" appears for each breakpoint. classes = [ width_class(width, nil), width_class(computer, "computer"), width_class(tablet, "tablet"), width_class(mobile, "mobile"), width_class(widescreen, "widescreen"), width_class(large_screen, "large screen"), only_class, (aligned && "#{aligned} aligned"), (floated && "#{floated} floated"), color, "column" ].compact.join(" ") tag.div(**(class: classes)) { @content } end |