Class: Primer::DetailsComponent::Summary

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

Overview

Use the Summary slot as a trigger to reveal the content.

Constant Summary

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

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(button: true, **system_arguments) ⇒ Summary

Returns a new instance of Summary.

Parameters:

  • button (Boolean) (defaults to: true)

    Whether to render the Summary as a button or not.

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



39
40
41
42
43
44
45
# File 'app/components/primer/details_component.rb', line 39

def initialize(button: true, **system_arguments)
  @button = button

  @system_arguments = system_arguments
  @system_arguments[:tag] = :summary
  @system_arguments[:role] = "button"
end

Instance Method Details

#componentObject



47
48
49
50
51
# File 'app/components/primer/details_component.rb', line 47

def component
  return Primer::BaseComponent.new(**@system_arguments) unless @button

  Primer::ButtonComponent.new(**@system_arguments)
end