class Primer::Beta::NavList

def build_avatar_item(src:, username:, full_name: nil, full_name_scheme: Primer::Alpha::ActionList::Item::DEFAULT_DESCRIPTION_SCHEME, component_klass: Primer::Beta::NavList::Item, avatar_arguments: {}, **system_arguments)

Parameters:
  • system_arguments (Hash) -- These arguments are forwarded to <%= link_to_component(Primer::Beta::NavList::Item) %>, or whatever class is passed as the `component_klass` argument.
  • avatar_arguments (Hash) -- Optional. The arguments accepted by <%= link_to_component(Primer::Beta::Avatar) %>
  • component_klass (Class) -- The class to use instead of the default <%= link_to_component(Primer::Beta::NavList::Item) %>
  • full_name_scheme (Symbol) -- Optional. How to display the user's full name. <%= one_of(Primer::Alpha::ActionList::Item::DESCRIPTION_SCHEME_OPTIONS) %>
  • full_name (String) -- Optional. The user's full name.
  • username (String) -- The username associated with the avatar.
  • src (String) -- The source url of the avatar image.
def build_avatar_item(src:, username:, full_name: nil, full_name_scheme: Primer::Alpha::ActionList::Item::DEFAULT_DESCRIPTION_SCHEME, component_klass: Primer::Beta::NavList::Item, avatar_arguments: {}, **system_arguments)
  component_klass.new(
    list: top_level_group,
    selected_item_id: @selected_item_id,
    label: username,
    description_scheme: full_name_scheme,
    **system_arguments
  ).tap do |item|
    item.with_leading_visual_raw_content do
      # no alt text necessary
      item.render(Primer::Beta::Avatar.new(src: src, **avatar_arguments, role: :presentation, size: 16))
    end
    item.with_description_content(full_name) if full_name
  end
end