Class: Primer::Alpha::ButtonMarketing
- Defined in:
- app/components/primer/alpha/button_marketing.rb
Overview
Use ‘ButtonMarketing` for actions (e.g. in forms). Use links for destinations, or moving from one page to another.
Constant Summary collapse
- DEFAULT_SCHEME =
:default
- SCHEME_MAPPINGS =
{ DEFAULT_SCHEME => "", :primary => "btn-signup-mktg", :outline => "btn-muted-mktg", :transparent => "btn-subtle-mktg" }.freeze
- SCHEME_OPTIONS =
SCHEME_MAPPINGS.keys
- DEFAULT_VARIANT =
:default
- VARIANT_MAPPINGS =
{ DEFAULT_VARIANT => "", :large => "btn-large-mktg" }.freeze
- VARIANT_OPTIONS =
VARIANT_MAPPINGS.keys
- DEFAULT_TAG =
:button
- TAG_OPTIONS =
[DEFAULT_TAG, :a].freeze
- DEFAULT_TYPE =
:button
- TYPE_OPTIONS =
[DEFAULT_TYPE, :submit].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 Primer::AttributesHelper
Primer::AttributesHelper::PLURAL_ARIA_ATTRIBUTES, Primer::AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(scheme: DEFAULT_SCHEME, variant: DEFAULT_VARIANT, tag: DEFAULT_TAG, type: DEFAULT_TYPE, disabled: false, **system_arguments) ⇒ ButtonMarketing
constructor
A new instance of ButtonMarketing.
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 Primer::AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(scheme: DEFAULT_SCHEME, variant: DEFAULT_VARIANT, tag: DEFAULT_TAG, type: DEFAULT_TYPE, disabled: false, **system_arguments) ⇒ ButtonMarketing
Returns a new instance of ButtonMarketing.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/components/primer/alpha/button_marketing.rb', line 37 def initialize( scheme: DEFAULT_SCHEME, variant: DEFAULT_VARIANT, tag: DEFAULT_TAG, type: DEFAULT_TYPE, disabled: false, **system_arguments ) @system_arguments = system_arguments @system_arguments[:block] = false @system_arguments[:tag] = fetch_or_fallback(TAG_OPTIONS, tag, DEFAULT_TAG) @system_arguments[:type] = fetch_or_fallback(TYPE_OPTIONS, type, DEFAULT_TYPE) @system_arguments[:classes] = class_names( "btn-mktg", SCHEME_MAPPINGS[fetch_or_fallback(SCHEME_OPTIONS, scheme, DEFAULT_SCHEME)], VARIANT_MAPPINGS[fetch_or_fallback(VARIANT_OPTIONS, variant, DEFAULT_VARIANT)], system_arguments[:classes] ) @system_arguments[:disabled] = disabled end |
Instance Method Details
#call ⇒ Object
58 59 60 |
# File 'app/components/primer/alpha/button_marketing.rb', line 58 def call render(Primer::Beta::BaseButton.new(**@system_arguments)) { content } end |