From f99d223992969e3be683c010deeb07433a3b533e Mon Sep 17 00:00:00 2001 From: "Jesse C. Fisher" Date: Wed, 8 Nov 2023 06:20:58 +0000 Subject: [PATCH] Add icons to social links --- app/assets/stylesheets/profiles.sass | 4 ++++ app/views/profiles/show.html.haml | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/assets/stylesheets/profiles.sass b/app/assets/stylesheets/profiles.sass index 89b4ec4d..df0a7259 100644 --- a/app/assets/stylesheets/profiles.sass +++ b/app/assets/stylesheets/profiles.sass @@ -9,3 +9,7 @@ a .profile span, p color: black + +.social-links + .x-logo + width: 1.4rem diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index 4742ec33..38199398 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -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 + -# = "".html_safe + %p + - @profile.social_links.each do |social_link| + - case social_link.url + - when /twitter\.com/, /x\.com/ + - social_icon = "" + -# = 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}