Module: NfgUi::Components::Traits::Icon

Includes:
Utilities::Traits::TraitUtilities
Included in:
Foundations::Icon
Defined in:
lib/nfg_ui/components/traits/icon.rb

Overview

Access to pre-designed Icon traits

Constant Summary collapse

TRAITS =
%i[loader tip].freeze

Instance Method Summary collapse

Instance Method Details

#loader_traitObject



12
13
14
# File 'lib/nfg_ui/components/traits/icon.rb', line 12

def loader_trait
  options[:icon] = 'spinner spin fw'
end

#tip_traitObject

The defacto “(?)” tip icon Usage: ui.nfg :icon, :tip, tooltip: ‘The tip’



19
20
21
22
23
24
25
26
27
28
# File 'lib/nfg_ui/components/traits/icon.rb', line 19

def tip_trait
  maybe_update_option(:icon, value: NfgUi::DEFAULT_TIP_ICON)

  maybe_update_option(:theme, value: NfgUi::DEFAULT_TIP_THEME)

  if options[:text].present?
    maybe_update_option(:right, value: true)
    options[:class] += ' fa-fw'
  end
end