Class: HakumiComponents::Alert::Component
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- HakumiComponents::Alert::Component
- Extended by:
- T::Sig
- Defined in:
- app/components/hakumi_components/alert/component.rb
Constant Summary collapse
- Type =
T.type_alias { T.any(Symbol, String) }
- TYPES =
T.let([ :success, :info, :warning, :error ].freeze, T::Array[Symbol])
Constants inherited from BaseComponent
BaseComponent::ControllerOptions, BaseComponent::DateInput, BaseComponent::DateLikeValue, BaseComponent::DimensionInput, BaseComponent::HtmlPayloadInput, BaseComponent::I18nOptionValue, BaseComponent::PresenceArray, BaseComponent::PresenceScalar, BaseComponent::PresenceValue, BaseComponent::RawHtmlInput, BaseComponent::SIZES, BaseComponent::SizeValue, BaseComponent::SymbolInput
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type: nil, show_icon: nil, closable: false, banner: false, message_text: nil, description_text: nil, **html_options) ⇒ Component
constructor
A new instance of Component.
Methods inherited from BaseComponent
#append_data_token, boolean_html_param, #build_inline_style, cast_boolean, #cast_boolean, #class_names, #component_classes, #data_attributes_from, #dimension_to_css, #ensure_dom_id!, float_html_param, #generate_id, #html_classes, html_param, html_primitive_param, #html_style, #i18n_scope, integer_html_param, #merge_attributes, #render_value, #size_to_pixels, #stimulus_attrs, string_html_param, string_or_symbol_array_html_param, symbol_html_param, #t_default, #translate_with_default, #validate_inclusion!, #validate_required!, #value_present?
Constructor Details
#initialize(type: nil, show_icon: nil, closable: false, banner: false, message_text: nil, description_text: nil, **html_options) ⇒ Component
Returns a new instance of Component.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/components/hakumi_components/alert/component.rb', line 45 def initialize( type: nil, show_icon: nil, closable: false, banner: false, message_text: nil, description_text: nil, ** ) @type = T.let((type || :info).to_sym, Symbol) @show_icon = T.let(show_icon.nil? ? : show_icon, T::Boolean) @closable = T.let(closable, T::Boolean) @banner = T.let(, T::Boolean) @message_text = T.let(, T.nilable(String)) @description_text = T.let(description_text, T.nilable(String)) @html_options = T.let(, HakumiComponents::Types::HtmlAttributes) validate_props! end |
Class Method Details
.extract_controller_locals(params) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'app/components/hakumi_components/alert/component.rb', line 23 def self.extract_controller_locals(params) { type: symbol_html_param(html_param(params, :type)), show_icon: boolean_html_param(html_param(params, :show_icon)), closable: boolean_html_param(html_param(params, :closable)), banner: boolean_html_param(html_param(params, :banner)), message_text: string_html_param(html_param(params, :message)), description_text: string_html_param(html_param(params, :description)) }.compact end |