Sha256: 088717a72b50700f7fd3df02b3e3662ceb06d997cf2b5973c79ded0312f831ac

Contents?: true

Size: 832 Bytes

Versions: 21

Compression:

Stored size: 832 Bytes

Contents

# frozen_string_literal: true

##
# Module to help generate icon helpers for SVG images
module Blacklight::IconHelperBehavior
  ##
  # Returns the raw SVG (String) for a Blacklight Icon located in
  # app/assets/images/blacklight/*.svg. Caches them so we don't have to look up
  # the svg everytime.
  # @param [String, Symbol] icon_name
  # @return [String]
  def blacklight_icon(icon_name, **kwargs)
    render "Blacklight::Icons::#{icon_name.to_s.camelize}Component".constantize.new(**kwargs)
  rescue NameError
    Blacklight.deprecation.warn(
      "Falling back on the LegacyIconComponent with \"#{icon_name}\" is deprecated. Instead create the component `Blacklight::Icons::#{icon_name.to_s.camelize}Component` for this icon."
    )

    render Blacklight::Icons::LegacyIconComponent.new(name: icon_name, **kwargs)
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
blacklight-8.6.1 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.6.0 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.5.1 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.5.0 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.4.0 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.3.0 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.2.2 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.2.1 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.2.0 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.1.0 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.0.1 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.0.0 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.0.0.beta8 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.0.0.beta7 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.0.0.beta6 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.0.0.beta5 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.0.0.beta4 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.0.0.beta3 app/helpers/blacklight/icon_helper_behavior.rb
blacklight-8.0.0.beta2 app/helpers/blacklight/icon_helper_behavior.rb