Class: PhlexUI::Avatar

Inherits:
Base
  • Object
show all
Defined in:
lib/phlex_ui/avatar.rb

Defined Under Namespace

Classes: Builder, Fallback, Image

Constant Summary collapse

SIZES =
{
  xs: "h-4 w-4 text-[0.5rem]",
  sm: "h-6 w-6 text-xs",
  md: "h-10 w-10 text-base",
  lg: "h-14 w-14 text-xl",
  xl: "h-20 w-20 text-3xl"
}

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#before_template

Constructor Details

#initialize(size: :md, **attrs) ⇒ Avatar

Returns a new instance of Avatar.



13
14
15
16
17
# File 'lib/phlex_ui/avatar.rb', line 13

def initialize(size: :md, **attrs)
  @size = size
  @size_classes = SIZES[@size]
  super(**attrs)
end

Instance Method Details

#view_templateObject



19
20
21
# File 'lib/phlex_ui/avatar.rb', line 19

def view_template(&)
  span(**attrs, &)
end