Class: NitroKit::Avatar
- Includes:
- Phlex::Rails::Helpers::ImageTag
- Defined in:
- app/components/nitro_kit/avatar.rb
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#src ⇒ Object
readonly
Returns the value of attribute src.
Attributes inherited from Component
Instance Method Summary collapse
- #image ⇒ Object
-
#initialize(src_arg = nil, src: nil, size: :md, **attrs) ⇒ Avatar
constructor
A new instance of Avatar.
- #view_template(&block) ⇒ Object
Methods inherited from Component
Constructor Details
#initialize(src_arg = nil, src: nil, size: :md, **attrs) ⇒ Avatar
Returns a new instance of Avatar.
7 8 9 10 11 12 13 14 15 |
# File 'app/components/nitro_kit/avatar.rb', line 7 def initialize(src_arg = nil, src: nil, size: :md, **attrs) @src = src_arg || src @size = size super( attrs, class: [ container_class, size_classes ] ) end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
17 18 19 |
# File 'app/components/nitro_kit/avatar.rb', line 17 def size @size end |
#src ⇒ Object (readonly)
Returns the value of attribute src.
17 18 19 |
# File 'app/components/nitro_kit/avatar.rb', line 17 def src @src end |
Instance Method Details
#image ⇒ Object
25 26 27 |
# File 'app/components/nitro_kit/avatar.rb', line 25 def image image_tag(src, class: image_class) end |
#view_template(&block) ⇒ Object
19 20 21 22 23 |
# File 'app/components/nitro_kit/avatar.rb', line 19 def view_template(&block) div(**attrs) do image end end |