| 
					
					
					
				 | 
				@ -1,18 +1,42 @@ | 
			
		
		
	
		
			
				 | 
				 | 
				# Font Awesome Helper | 
				 | 
				 | 
				# Font Awesome Helper | 
			
		
		
	
		
			
				 | 
				 | 
				module FaIconHelper | 
				 | 
				 | 
				module FaIconHelper | 
			
		
		
	
		
			
				 | 
				 | 
				  # accept name without 'fa-' prefix, style: (solid by default), size:, class: and 'aria-hidden': | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  ## | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  # mandatory: | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  #   name: without 'fa-' prefix | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  #     might be a symbol, automatic conversion of undashed symbol | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  #       for instance symbol :magnify_lens is converted to string 'magnify-lens' | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  # optional: | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  #   stroke: [:solid|:regular|:brands] solid as default value | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  #   size: [2x, 3x, ... ] | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  #   class: extra classes, any tailwind keyword... | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  #   aria-hidden: true as default value | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  # | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  # example: | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  #   fa_icon(:user) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  #   fa_icon(:user, stroke: :regular) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  #   fa_icon(:user, size: '2x') | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  #   fa_icon(:user, class: 'text-blue-500') | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  ## | 
			
		
		
	
		
			
				 | 
				 | 
				  def fa_icon(name, html_options = {}) | 
				 | 
				 | 
				  def fa_icon(name, html_options = {}) | 
			
		
		
	
		
			
				 | 
				 | 
				    html_options[:style] ||= :solid | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				    html_options['aria-hidden'] ||= true | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    warn_useless_options html_options | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				    content_class = "fa-#{to_dash(html_options[:style])} fa-#{to_dash(name)}" | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				    content_class << " fa-#{to_dash(html_options[:size])}" if html_options.key? :size | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    icon = to_dash(name) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    stroke = to_dash(html_options[:stroke] || :solid) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    content_class = "fa-#{icon} fa-#{stroke}" | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    content_class << " fa-#{html_options[:size]}" if html_options.key? :size | 
			
		
		
	
		
			
				 | 
				 | 
				    content_class << " #{html_options[:class]}" if html_options.key? :class | 
				 | 
				 | 
				    content_class << " #{html_options[:class]}" if html_options.key? :class | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				    tag.i(class: content_class, 'aria-hidden': html_options['aria-hidden']) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    tag.i(class: content_class, 'aria-hidden': html_options['aria-hidden'] || true) | 
			
		
		
	
		
			
				 | 
				 | 
				  end | 
				 | 
				 | 
				  end | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				  private | 
				 | 
				 | 
				  private | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				  def to_dash(symbol) = symbol.to_s.dasherize | 
				 | 
				 | 
				  def to_dash(symbol) = symbol.to_s.dasherize | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  def warn_useless_options(hash) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    hash.except(:stroke, :size, :class, 'aria-hidden').each_key do |key| | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				      SemanticLogger[Module.nesting[0]].warn "useless option <#{key}>, please consider removal for safety reason!" | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				    end | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				  end | 
			
		
		
	
		
			
				 | 
				 | 
				end | 
				 | 
				 | 
				end |