Class: Railsboot::AvatarGroupComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/railsboot/avatar_group_component.rb

Overview

ViewComponent: renders the avatar group block.

Instance Method Summary collapse

Constructor Details

#initialize(reverse: false, **html_attributes) ⇒ AvatarGroupComponent

Returns a new instance of AvatarGroupComponent.

Parameters:

  • reverse (Boolean) (defaults to: false)

    the reverse option

  • html_attributes (Hash)

    additional HTML attributes applied to the rendered element

Options Hash (**html_attributes):

  • :class (String)

    additional CSS classes, merged with the component's own classes

  • :style (String)

    additional HTML attribute forwarded to the element



10
11
12
13
14
15
16
17
18
19
20
# File 'app/components/railsboot/avatar_group_component.rb', line 10

def initialize(reverse: false, **html_attributes)
  @reverse = reverse
  @html_attributes = html_attributes

  @html_attributes[:class] = class_names(
    "d-flex",
    html_attributes.delete(:class)
  )

  @html_attributes[:style] = [html_attributes[:style], "flex-direction: row-reverse; justify-content: flex-end;"].compact_blank.join(" ") if @reverse
end