Class: Fluxbit::BottomNavigationComponent::Item
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Fluxbit::BottomNavigationComponent::Item
- Includes:
- Config::BottomNavigationComponent
- Defined in:
- app/components/fluxbit/bottom_navigation_component.rb
Overview
Item component for bottom navigation
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(**props, &block) ⇒ Item
constructor
Initializes the item component.
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, &block) ⇒ Item
Initializes the item component.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'app/components/fluxbit/bottom_navigation_component.rb', line 145 def initialize(**props, &block) super(**props, &block) @props = props @parent_config = @props.delete(:parent_config) @parent_variant = @props.delete(:parent_variant) || :default @href = @props.delete(:href) || "#" @icon = @props.delete(:icon) @active = (@props.delete(:active), default: false) @tooltip_text = @props.delete(:tooltip_text) @sr_only = (@props.delete(:sr_only), default: @parent_variant == :app_bar) add(class: styles[:item][:base], to: @props, first_element: true) add(class: styles[:item][:active], to: @props) if @active add(class: styles[:item][:inactive], to: @props) unless @active @props[:class] = remove_class(@props.delete(:remove_class) || "", @props[:class]) end |
Instance Method Details
#call ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'app/components/fluxbit/bottom_navigation_component.rb', line 164 def call setup_data_attributes = tag.(type: "button", **@props) do concat(render_icon) if @icon concat(tag.span(content, class: text_classes)) end if @tooltip_text safe_join([, render_tooltip]) else end end |