Module: FComponents::IconsHelper
- Defined in:
- app/helpers/f_components/icons_helper.rb
Instance Method Summary collapse
- #f_icon(options) ⇒ Object
-
#fa_icon(name, options = {}) ⇒ Object
Public: Creates a icon tag Examples:.
Instance Method Details
#f_icon(options) ⇒ Object
27 28 29 30 31 32 |
# File 'app/helpers/f_components/icons_helper.rb', line 27 def f_icon() text = .delete(:text) tag = content_tag(:i, nil, ) tag << " #{text}" if text.present? tag end |
#fa_icon(name, options = {}) ⇒ Object
Public: Creates a icon tag Examples:
fa_icon(‘eye’) #=> <i class=“fas fa-eye”></i>
fa_icon(‘eye’, prefix: ‘far’) <i class=“far fa-eye”></i>
fa_icon(‘eye’, class: ‘strong space-x-2’) #=> <i class=“fas fa-eye strong space-x-2”></i>
fa_icon(‘eye’, class: ‘strong space-x-2’, text: ‘my text’) #=> <i class=“fas fa-eye strong space-x-2”></i> my text
19 20 21 22 23 24 25 |
# File 'app/helpers/f_components/icons_helper.rb', line 19 def fa_icon(name, = {}) fa_prefix = .delete(:prefix) { 'fas' } icon_name = "fa-#{name}" custom_classes = [:class].presence [:class] = [fa_prefix, icon_name, custom_classes].compact.join(' ') f_icon() end |