Class: Primer::TimelineItemComponent::Badge

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

Overview

:nodoc:

Constant Summary

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from JoinStyleArgumentsHelper

#join_style_arguments

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(icon: nil, **system_arguments) ⇒ Badge

Returns a new instance of Badge.

Parameters:

  • icon (String) (defaults to: nil)

    Name of [Octicon](primer.style/octicons/) to use.

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



69
70
71
72
73
74
75
76
77
78
# File 'app/components/primer/timeline_item_component.rb', line 69

def initialize(icon: nil, **system_arguments)
  @icon = icon

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

Instance Attribute Details

#iconObject (readonly)

Returns the value of attribute icon.



65
66
67
# File 'app/components/primer/timeline_item_component.rb', line 65

def icon
  @icon
end

#system_argumentsObject (readonly)

Returns the value of attribute system_arguments.



65
66
67
# File 'app/components/primer/timeline_item_component.rb', line 65

def system_arguments
  @system_arguments
end