Class: Primer::OpenProject::GridLayout::Area
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Primer::OpenProject::GridLayout::Area
- Defined in:
- app/components/primer/open_project/grid_layout/area.rb
Overview
GridLayout::Area is an internal component that wraps the items in a div with the given new class and responding “grid-area”
Constant Summary collapse
- DEFAULT_TAG =
:div
- TAG_OPTIONS =
[DEFAULT_TAG, :span].freeze
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(css_class, area_name, component = ::Primer::BaseComponent, tag: DEFAULT_TAG, **system_arguments) ⇒ Area
constructor
A new instance of Area.
Methods inherited from Component
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Methods included from AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(css_class, area_name, component = ::Primer::BaseComponent, tag: DEFAULT_TAG, **system_arguments) ⇒ Area
Returns a new instance of Area.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/components/primer/open_project/grid_layout/area.rb', line 18 def initialize(css_class, area_name, component = ::Primer::BaseComponent, tag: DEFAULT_TAG, **system_arguments) @component = component @system_arguments = system_arguments @styles = [ "grid-area: #{area_name}" ] @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG) @system_arguments[:style] = join_style_arguments(@system_arguments[:style], *@styles) @system_arguments[:classes] = class_names( @system_arguments[:classes], "#{css_class}--#{area_name}" ) end |
Instance Method Details
#call ⇒ Object
32 33 34 |
# File 'app/components/primer/open_project/grid_layout/area.rb', line 32 def call render(@component.new(**@system_arguments)) { content } end |