Class: Primer::PopoverComponent::Body
- Defined in:
- app/components/primer/popover_component.rb
Constant Summary collapse
- CARET_DEFAULT =
:top- CARET_MAPPINGS =
{ CARET_DEFAULT => "", :bottom => "Popover-message--bottom", :bottom_right => "Popover-message--bottom-right", :bottom_left => "Popover-message--bottom-left", :left => "Popover-message--left", :left_bottom => "Popover-message--left-bottom", :left_top => "Popover-message--left-top", :right => "Popover-message--right", :right_bottom => "Popover-message--right-bottom", :right_top => "Popover-message--right-top", :top_left => "Popover-message--top-left", :top_right => "Popover-message--top-right" }.freeze
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
- #component ⇒ Object
-
#initialize(caret: CARET_DEFAULT, large: false, **kwargs) ⇒ Body
constructor
A new instance of Body.
Methods included from FetchOrFallbackHelper
Methods included from ClassNameHelper
Constructor Details
#initialize(caret: CARET_DEFAULT, large: false, **kwargs) ⇒ Body
Returns a new instance of Body.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'app/components/primer/popover_component.rb', line 93 def initialize(caret: CARET_DEFAULT, large: false, **kwargs) @kwargs = kwargs @kwargs[:classes] = class_names( kwargs[:classes], "Popover-message Box", CARET_MAPPINGS[fetch_or_fallback(CARET_MAPPINGS.keys, caret, CARET_DEFAULT)], "Popover-message--large" => large ) @kwargs[:p] ||= 4 @kwargs[:mt] ||= 2 @kwargs[:mx] ||= :auto @kwargs[:text_align] ||= :left @kwargs[:box_shadow] ||= :large end |
Instance Method Details
#component ⇒ Object
108 109 110 |
# File 'app/components/primer/popover_component.rb', line 108 def component Primer::BoxComponent.new(**@kwargs) end |