Class: Warped::Emails::Button
- Defined in:
- lib/warped/emails/components/button.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(text = nil, href, type: :primary, size: :md) ⇒ Button
constructor
A new instance of Button.
- #template ⇒ Object
- #text ⇒ Object
Methods inherited from Base
#content, #helpers, #render_in
Methods included from Styleable
#base_styles, #default_variants, included, #style, #variants
Methods included from Slottable
Constructor Details
#initialize(text = nil, href, type: :primary, size: :md) ⇒ Button
Returns a new instance of Button.
35 36 37 38 39 40 41 |
# File 'lib/warped/emails/components/button.rb', line 35 def initialize(text = nil, href, type: :primary, size: :md) super() @text = text @href = href @type = type @size = size end |
Instance Method Details
#template ⇒ Object
47 48 49 50 51 |
# File 'lib/warped/emails/components/button.rb', line 47 def template style = style(type:, size:) tag.a(text, href:, style:) end |
#text ⇒ Object
43 44 45 |
# File 'lib/warped/emails/components/button.rb', line 43 def text content.presence || @text end |