Class: Fluxbit::BannerComponent
- Includes:
- Config::BannerComponent
- Defined in:
- app/components/fluxbit/banner_component.rb
Overview
The ‘Fluxbit::BannerComponent` is a customizable banner component that extends `Fluxbit::Component`. It provides various options to display banner messages with different styles, positions, and behaviors such as close functionality and call-to-action elements.
Example usage:
= render Fluxbit::BannerComponent.new(position: :top, color: :info).with_content("Banner message")
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**props) ⇒ Fluxbit::BannerComponent
constructor
Initializes the banner component with the given properties.
Methods inherited from Component
#add, #add_popover_or_tooltip, #anyicon, #element_name, #fx_id, #icon, #options, #popover?, #random_id, #remove_class, #remove_class_from_props, #render_popover_or_tooltip, #target, #tooltip?
Methods included from IconHelpers
#chevron_double_left, #chevron_double_right, #chevron_down, #chevron_left, #chevron_right, #chevron_up, #close_icon, #ellipsis_horizontal, #eye_icon, #eye_slash_icon, #plus_icon
Constructor Details
#initialize(**props) ⇒ Fluxbit::BannerComponent
Initializes the banner component with the given properties.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/components/fluxbit/banner_component.rb', line 40 def initialize(**props) super @props = props @position = define_position(@props.delete(:position) || @@position) @color = define_color(@props.delete(:color) || @@color) icon_prop = @props.delete(:icon) icon_html = @props.delete(:icon_html) || {} @icon = define_icon(icon_prop.nil? ? :default : icon_prop, icon_html) @dismissible = @props[:dismissible].nil? ? @@dismissible : @props.delete(:dismissible) @full_width = @props[:full_width].nil? ? @@full_width : @props.delete(:full_width) @props["id"] = fx_id if @props["id"].nil? declare_classes @props[:class] = remove_class(@props.delete(:remove_class) || "", @props[:class]) end |
Instance Method Details
#call ⇒ Object
56 57 58 59 60 |
# File 'app/components/fluxbit/banner_component.rb', line 56 def call tag.div(**@props) do concat end end |