class Primer::Alpha::Banner
Use ‘Banner` to highlight important information.
def catalyst_action(event:, function:)
def catalyst_action(event:, function:) "#{event}:#{custom_element_name}##{function}" end
def catalyst_target(field:)
def catalyst_target(field:) "#{custom_element_name}.#{field}" end
def custom_element_name
def custom_element_name "x-banner" end
def initialize(full: false, full_when_narrow: false, dismiss_scheme: DEFAULT_DISMISS_SCHEME, description: nil, icon: nil, scheme: DEFAULT_SCHEME, **system_arguments)
-
system_arguments
(Hash
) -- <%= link_to_system_arguments_docs %> -
scheme
(Symbol
) -- <%= one_of(Primer::Alpha::Banner::SCHEME_MAPPINGS.keys) %> -
icon
(Symbol
) -- The name of an <%= link_to_octicons %> icon to use. If no icon is provided, a default one will be chosen based on the scheme. -
description
(String
) -- Description text rendered underneath the message. -
dismiss_scheme
(Symbol
) -- Whether the component can be dismissed with an "x" button. <%= one_of(Primer::Alpha::Banner::DISMISS_SCHEMES) %> -
full_when_narrow
(Boolean
) -- Whether the component should take up the full width of the screen when rendered inside smaller viewports. -
full
(Boolean
) -- Whether the component should take up the full width of the screen.
def initialize(full: false, full_when_narrow: false, dismiss_scheme: DEFAULT_DISMISS_SCHEME, description: nil, icon: nil, scheme: DEFAULT_SCHEME, **system_arguments) @scheme = fetch_or_fallback(SCHEME_MAPPINGS.keys, scheme, DEFAULT_SCHEME) @icon = icon || DEFAULT_ICONS[@scheme] @dismiss_scheme = dismiss_scheme @description = description @system_arguments = deny_tag_argument(**system_arguments) @system_arguments[:tag] = :div @system_arguments[:classes] = class_names( @system_arguments[:classes], "Banner", "flash", # legacy SCHEME_MAPPINGS[@scheme], LEGACY_SCHEME_MAPPINGS[@scheme], "Banner--full": full, "flash-full": full, # legacy "Banner--full-whenNarrow": full_when_narrow ) @message_arguments = { tag: :div, classes: "Banner-message" } @wrapper_arguments = { tag: custom_element_name, data: { dismiss_scheme: @dismiss_scheme } } end