Class: Essence::Link
- Defined in:
- lib/essence/components/link.rb
Constant Summary collapse
- CLASS =
"inline-flex items-center gap-1 font-medium text-gray-900 border-b-2 hover:border-gray-900 transition-colors"
- KINDS =
{ regular: "border-transparent", underline: "border-gray-200" }
Constants inherited from Essence
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(kind: :regular, **attributes) ⇒ Link
constructor
A new instance of Link.
- #view_template ⇒ Object
Constructor Details
#initialize(kind: :regular, **attributes) ⇒ Link
Returns a new instance of Link.
12 13 14 15 |
# File 'lib/essence/components/link.rb', line 12 def initialize(kind: :regular, **attributes) @attributes = attributes @attributes[:class] = @attributes[:class] ? TAILWIND_MERGER.merge([ CLASS, @attributes[:class] ]) : CLASS end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
10 11 12 |
# File 'lib/essence/components/link.rb', line 10 def attributes @attributes end |
Instance Method Details
#view_template ⇒ Object
17 18 19 |
# File 'lib/essence/components/link.rb', line 17 def view_template(&) a(**attributes, &) end |