Class: Primer::FlexItemComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/primer/flex_item_component.rb

Constant Summary collapse

FLEX_AUTO_DEFAULT =
false
FLEX_AUTO_ALLOWED_VALUES =
[FLEX_AUTO_DEFAULT, true]

Constants included from FetchOrFallbackHelper

Primer::FetchOrFallbackHelper::InvalidValueError

Instance Method Summary collapse

Methods included from FetchOrFallbackHelper

#fetch_or_fallback

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(flex_auto: FLEX_AUTO_DEFAULT, **system_arguments) ⇒ FlexItemComponent

Returns a new instance of FlexItemComponent.



8
9
10
11
12
13
14
15
# File 'app/components/primer/flex_item_component.rb', line 8

def initialize(flex_auto: FLEX_AUTO_DEFAULT, **system_arguments)
  @system_arguments = system_arguments
  @system_arguments[:classes] =
    class_names(
      @system_arguments[:classes],
      "flex-auto" => fetch_or_fallback(FLEX_AUTO_ALLOWED_VALUES, flex_auto, FLEX_AUTO_DEFAULT)
    )
end

Instance Method Details

#callObject



17
18
19
# File 'app/components/primer/flex_item_component.rb', line 17

def call
  render(Primer::BoxComponent.new(**@system_arguments)) { content }
end