class Primer::Beta::Avatar
def initialize(src:, alt: nil, size: DEFAULT_SIZE, shape: DEFAULT_SHAPE, href: nil, **system_arguments)
-
system_arguments
(Hash
) -- <%= link_to_system_arguments_docs %> -
href
(String
) -- The URL to link to. If used, component will be wrapped by an `` tag. -
shape
(Symbol
) -- Shape of the avatar. <%= one_of(Primer::Beta::Avatar::SHAPE_OPTIONS) %> -
size
(Integer
) -- <%= one_of(Primer::Beta::Avatar::SIZE_OPTIONS) %> -
alt
(String
) -- Passed through to alt on img tag. -
src
(String
) -- The source url of the avatar image.
def initialize(src:, alt: nil, size: DEFAULT_SIZE, shape: DEFAULT_SHAPE, href: nil, **system_arguments) @href = href @system_arguments = deny_tag_argument(**system_arguments) @system_arguments[:tag] = :img @system_arguments[:src] = src @system_arguments[:alt] = alt @system_arguments[:size] = fetch_or_fallback(SIZE_OPTIONS, size, DEFAULT_SIZE) @system_arguments[:height] = @system_arguments[:size] @system_arguments[:width] = @system_arguments[:size] @system_arguments[:classes] = class_names( system_arguments[:classes], "avatar", "avatar-small" => size < SMALL_THRESHOLD, "circle" => shape == DEFAULT_SHAPE, "lh-0" => href # Addresses an overflow issue with linked avatars ) end