Add icons to social links

This commit is contained in:
Jesse C. Fisher 2023-11-08 06:20:58 +00:00
parent 78a4b725a6
commit f99d223992
2 changed files with 16 additions and 6 deletions

View File

@ -9,3 +9,7 @@
a .profile
span, p
color: black
.social-links
.x-logo
width: 1.4rem

View File

@ -7,12 +7,18 @@
%p
= @profile.summary
-# Social Links
%p
- @profile.social_links.each do |social_link|
= link_to "#{social_link.url}", "https://#{social_link.url}"
- if policy(@profile).edit?
%br= link_to '+ Add Social Link', new_social_link_path(profile_id: @profile.id)
.social-links
-# = "<svg class='x-logo' viewBox='0 0 24 24' aria-hidden='true'><g><path d='M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z'></path></g></svg>".html_safe
%p
- @profile.social_links.each do |social_link|
- case social_link.url
- when /twitter\.com/, /x\.com/
- social_icon = "<svg class='x-logo' viewBox='0 0 24 24' aria-hidden='true'><g><path d='M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z'></path></g></svg>"
-# = link_to "#{social_icon} #{social_link.url}".html_safe, "https://#{social_link.url}"
= link_to "https://#{social_link.url}" do
#{social_icon.try("html_safe") || "🌐"}
- if policy(@profile).edit?
%br= link_to '+ Add Social Link', new_social_link_path(profile_id: @profile.id)
%h2 About #{@profile.name}