Class: Primer::TimelineItemComponent

Inherits:
Component
  • Object
show all
Includes:
ViewComponent::Slotable
Defined in:
app/components/primer/timeline_item_component.rb

Defined Under Namespace

Classes: Avatar, Badge, Body

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(condensed: false, **kwargs) ⇒ TimelineItemComponent

Returns a new instance of TimelineItemComponent.



12
13
14
15
16
17
18
19
20
# File 'app/components/primer/timeline_item_component.rb', line 12

def initialize(condensed: false, **kwargs)
  @kwargs = kwargs
  @kwargs[:tag] = :div
  @kwargs[:classes] = class_names(
    "TimelineItem",
    condensed ? "TimelineItem--condensed" : "",
    kwargs[:classes]
  )
end

Instance Attribute Details

#kwargsObject (readonly)

Returns the value of attribute kwargs.



11
12
13
# File 'app/components/primer/timeline_item_component.rb', line 11

def kwargs
  @kwargs
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/components/primer/timeline_item_component.rb', line 22

def render?
  avatar.present? || badge.present? || body.present?
end