Sha256: 8151ff6124f1726d9ff9cbb48f22d89ea31be1aebe7371146a5dc02aaf45cf1b

Contents?: true

Size: 787 Bytes

Versions: 12

Compression:

Stored size: 787 Bytes

Contents

# frozen_string_literal: true

module NfgUi
  module Components
    module Traits
      # Access to pre-designed Icon traits
      module Icon
        include NfgUi::Components::Utilities::Traits::TraitUtilities

        TRAITS = %i[loader tip].freeze

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

        # The defacto "(?)" tip icon
        # Usage:
        # ui.nfg :icon, :tip, tooltip: 'The tip'
        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
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nfg_ui-0.10.5 lib/nfg_ui/components/traits/icon.rb
nfg_ui-0.10.4.1 lib/nfg_ui/components/traits/icon.rb
nfg_ui-0.10.4 lib/nfg_ui/components/traits/icon.rb
nfg_ui-0.10.3 lib/nfg_ui/components/traits/icon.rb
nfg_ui-0.10.2 lib/nfg_ui/components/traits/icon.rb
nfg_ui-0.10.1 lib/nfg_ui/components/traits/icon.rb
nfg_ui-0.10 lib/nfg_ui/components/traits/icon.rb
nfg_ui-0.9.28 lib/nfg_ui/components/traits/icon.rb
nfg_ui-0.9.27 lib/nfg_ui/components/traits/icon.rb
nfg_ui-0.9.26 lib/nfg_ui/components/traits/icon.rb
nfg_ui-0.9.25.1 lib/nfg_ui/components/traits/icon.rb
nfg_ui-0.9.25 lib/nfg_ui/components/traits/icon.rb