Class: Essence::Row
- Defined in:
- lib/essence/components/row.rb
Constant Summary collapse
- CLASS =
"flex gap-4"
- KINDS =
{ default: "flex-col md:flex-row md:items-center md:justify-between", center: "flex-col md:flex-row md:items-center md:justify-center", start: "flex-col md:flex-row md:items-center md:justify-start", end: "flex-col md:flex-row md:items-center md:justify-end", }
Constants inherited from Essence
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
Instance Method Summary collapse
-
#initialize(kind: :default, **attributes) ⇒ Row
constructor
A new instance of Row.
- #item(**attrs) ⇒ Object
- #view_template ⇒ Object
Constructor Details
#initialize(kind: :default, **attributes) ⇒ Row
Returns a new instance of Row.
16 17 18 19 20 |
# File 'lib/essence/components/row.rb', line 16 def initialize(kind: :default, **attributes) @kind = kind @attributes = attributes @attributes[:class] = @attributes[:class] ? TAILWIND_MERGER.merge([ CLASS, KINDS[kind], @attributes[:class] ]) : CLASS end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
14 15 16 |
# File 'lib/essence/components/row.rb', line 14 def attributes @attributes end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
13 14 15 |
# File 'lib/essence/components/row.rb', line 13 def kind @kind end |
Instance Method Details
#item(**attrs) ⇒ Object
26 27 28 |
# File 'lib/essence/components/row.rb', line 26 def item(**attrs, &) div(class: TAILWIND_MERGER.merge([ "flex items-center gap-2 flex-wrap", iattrs[:class] ]), **attrs, &) end |
#view_template ⇒ Object
22 23 24 |
# File 'lib/essence/components/row.rb', line 22 def view_template(&) div(**attributes, &) end |