Browse Source

fontawesome helper

main
pvincent 5 months ago
parent
commit
80285bad3a
  1. 9
      app/helpers/icon_helper.rb
  2. 2
      app/views/layouts/_navbar.html.erb

9
app/helpers/icon_helper.rb

@ -0,0 +1,9 @@
# Font Awesome Helper
module IconHelper
def icon(name = :home, classname = nil, options = {}, style: :regular)
clazz = "fa-#{style.to_s.dasherize} fa-#{name.to_s.dasherize}"
clazz += " #{options[:class]}" if options[:class]
clazz += " #{classname}" if classname
tag.i(class: clazz)
end
end

2
app/views/layouts/_navbar.html.erb

@ -1,7 +1,7 @@
<nav>
<ul>
<li>
A<i class="fa-solid fa-house"></i>
A<%=icon :user, 'text-6xl'%>
</li>
<li>
B<i class="fa-solid fa-magnifying-glass"></i>

Loading…
Cancel
Save