Class: Yattho::Alpha::ActionList::Divider

Inherits:
Component
  • Object
show all
Defined in:
app/components/yattho/alpha/action_list/divider.rb

Overview

Section heading rendered above the section contents.

Constant Summary collapse

DEFAULT_SCHEME =
:subtle
SCHEME_MAPPINGS =
{
  DEFAULT_SCHEME => nil,
  :filled => "ActionList-sectionDivider--filled"
}.freeze
SCHEME_OPTIONS =
SCHEME_MAPPINGS.keys.freeze

Constants inherited from Component

Component::INVALID_ARIA_LABEL_TAGS

Constants included from Status::Dsl

Status::Dsl::STATUSES

Constants included from ViewHelper

ViewHelper::HELPERS

Constants included from TestSelectorHelper

TestSelectorHelper::TEST_SELECTOR_TAG

Constants included from FetchOrFallbackHelper

FetchOrFallbackHelper::InvalidValueError

Instance Method Summary collapse

Methods inherited from Component

deprecated?, generate_id

Methods included from JoinStyleArgumentsHelper

#join_style_arguments

Methods included from TestSelectorHelper

#add_test_selector

Methods included from FetchOrFallbackHelper

#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(scheme: DEFAULT_SCHEME, **system_arguments) ⇒ Divider

Returns a new instance of Divider.

Parameters:

  • scheme (Symbol) (defaults to: DEFAULT_SCHEME)

    Display a background color if scheme is ‘filled`.

  • system_arguments (Hash)

    <%= link_to_system_arguments_docs %>



17
18
19
20
21
22
23
24
25
26
27
# File 'app/components/yattho/alpha/action_list/divider.rb', line 17

def initialize(scheme: DEFAULT_SCHEME, **system_arguments)
  @system_arguments = system_arguments
  @system_arguments[:tag] = :li
  @system_arguments[:role] = :separator
  @system_arguments[:'aria-hidden'] = true
  @scheme = fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)
  @system_arguments[:classes] = class_names(
    "ActionList-sectionDivider",
    SCHEME_MAPPINGS[@scheme]
  )
end

Instance Method Details

#callObject



29
30
31
# File 'app/components/yattho/alpha/action_list/divider.rb', line 29

def call
  render(Yattho::BaseComponent.new(**@system_arguments)) { "" }
end