Class: BulmaX::Navbar::NavbarMenu::NavbarItem

Inherits:
BaseComponent
  • Object
show all
Defined in:
lib/bulma_x/navbar.rb

Constant Summary

Constants inherited from BaseComponent

BaseComponent::BLANK_VALUES, BaseComponent::BOOLEAN, BaseComponent::COLORS, BaseComponent::COLOR_MODIFIER, BaseComponent::COLOR_PALETTE, BaseComponent::MODIFIERS, BaseComponent::MODIFIERS_DECLINED, BaseComponent::MODIFIERS_PALETTE

Constants included from Shared::SpacingOptions

Shared::SpacingOptions::VALID_SPACING_KEYS, Shared::SpacingOptions::VALID_SPACING_VALUES

Instance Method Summary collapse

Methods inherited from BaseComponent

#after_template, #attributes, #base_attributes, #base_classes, #before_template, #classes, #compact_blank, #css, #initialize, #render_root

Methods included from Shared::AriaOptions

#aria_attributes, included

Methods included from Shared::GlobalOptions

#global_attributes, #global_classes, included

Methods included from Shared::DataOptions

#data_attributes, included

Methods included from Shared::FlexOptions

#flex_classes, included

Methods included from Shared::SpacingOptions

included, #spacing_classes

Methods included from Shared::TextOptions

included, #text_classes

Methods included from ComponentDsl

included

Constructor Details

This class inherits a constructor from BulmaX::BaseComponent

Instance Method Details

#root_attributesObject



114
115
116
117
118
119
120
# File 'lib/bulma_x/navbar.rb', line 114

def root_attributes
  if root_tag == :a
    super.merge(href: @href)
  else
    super
  end
end

#root_classesObject



122
123
124
125
126
127
128
129
130
# File 'lib/bulma_x/navbar.rb', line 122

def root_classes
  extra_classes = ['navbar-item']
  extra_classes << 'has-dropdown' if slot?(:dropdown)
  extra_classes << 'is-active' if @active

  extra_classes << 'is-hoverable' if @hoverable

  super + extra_classes
end

#root_tagObject



106
107
108
109
110
111
112
# File 'lib/bulma_x/navbar.rb', line 106

def root_tag
  if slot?(:dropdown)
    :div
  else
    :a
  end
end

#view_templateObject



132
133
134
135
136
137
138
139
140
# File 'lib/bulma_x/navbar.rb', line 132

def view_template
  super do
    if slot?(:dropdown)
      slot(:dropdown)
    elsif block_given?
      yield
    end
  end
end