Class: Primer::TimelineItemComponent::Avatar

Inherits:
Slot
  • Object
show all
Defined in:
app/components/primer/timeline_item_component.rb

Constant Summary

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FetchOrFallbackHelper

#fetch_or_fallback

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(alt: nil, src: nil, size: 40, square: true, **system_arguments) ⇒ Avatar

Returns a new instance of Avatar.

Parameters:

  • alt (String) (defaults to: nil)

    Alt text for avatar image.

  • src (String) (defaults to: nil)

    Src attribute for avatar image.

  • size (Integer) (defaults to: 40)

    Image size.

  • square (Boolean) (defaults to: true)

    Whether to round the edges of the image.

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/components/primer/timeline_item_component.rb', line 47

def initialize(alt: nil, src: nil, size: 40, square: true, **system_arguments)
  @alt = alt
  @src = src
  @size = size
  @square = square

  @system_arguments = system_arguments
  @system_arguments[:tag] = :div
  @system_arguments[:classes] = class_names(
    "TimelineItem-avatar",
    system_arguments[:classes]
  )
end

Instance Attribute Details

#altObject (readonly)

Returns the value of attribute alt.



40
41
42
# File 'app/components/primer/timeline_item_component.rb', line 40

def alt
  @alt
end

#sizeObject (readonly)

Returns the value of attribute size.



40
41
42
# File 'app/components/primer/timeline_item_component.rb', line 40

def size
  @size
end

#squareObject (readonly)

Returns the value of attribute square.



40
41
42
# File 'app/components/primer/timeline_item_component.rb', line 40

def square
  @square
end

#srcObject (readonly)

Returns the value of attribute src.



40
41
42
# File 'app/components/primer/timeline_item_component.rb', line 40

def src
  @src
end

#system_argumentsObject (readonly)

Returns the value of attribute system_arguments.



40
41
42
# File 'app/components/primer/timeline_item_component.rb', line 40

def system_arguments
  @system_arguments
end