class Primer::Beta::AvatarStack
Use ‘AvatarStack` to stack multiple avatars together.
def before_render
def before_render @system_arguments[:classes] = class_names( @system_arguments[:classes], "AvatarStack--two" => avatars.size == 2, "AvatarStack--three-plus" => avatars.size > 2 ) end
def body_component
def body_component if @tooltipped Primer::Tooltip.new(**@body_arguments) # rubocop:disable Primer/ComponentNameMigration else Primer::BaseComponent.new(**@body_arguments) end end
def initialize(tag: DEFAULT_TAG, align: ALIGN_DEFAULT, tooltipped: false, body_arguments: {}, **system_arguments)
-
system_arguments
(Hash
) -- <%= link_to_system_arguments_docs %> -
body_arguments
(Hash
) -- Parameters to add to the Body. If `tooltipped` is set, has the same arguments as <%= link_to_component(Primer::Tooltip) %>. -
tooltipped
(Boolean
) -- Whether to add a tooltip to the stack or not. -
align
(Symbol
) -- <%= one_of(Primer::Beta::AvatarStack::ALIGN_OPTIONS) %> -
tag
(Symbol
) -- <%= one_of(Primer::Beta::AvatarStack::TAG_OPTIONS) %>
def initialize(tag: DEFAULT_TAG, align: ALIGN_DEFAULT, tooltipped: false, body_arguments: {}, **system_arguments) @align = fetch_or_fallback(ALIGN_OPTIONS, align, ALIGN_DEFAULT) @system_arguments = system_arguments @tooltipped = tooltipped @body_arguments = body_arguments body_tag = @body_arguments[:tag] || DEFAULT_BODY_TAG @body_arguments[:tag] = fetch_or_fallback(BODY_TAG_OPTIONS, body_tag, DEFAULT_BODY_TAG) @body_arguments[:classes] = class_names( "AvatarStack-body", @body_arguments[:classes] ) @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG) @system_arguments[:classes] = class_names( "AvatarStack", system_arguments[:classes], "AvatarStack--right" => @align == :right ) end
def render?
def render? avatars.any? end