Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

Commit cc93237

Browse files
authored
feat: color to social media icons (#106)
* feat: add color to social media icons * fix: updates usage of socialIcon function * fix: remove wrapper functions on socialIcons * fix: shows relevant socialIcons color in profile and platform page * refactor: removes template literals
1 parent 7a8e441 commit cc93237

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

src/components/Header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default function Header({ session, user }) {
7474
<span className="absolute -inset-1.5" />
7575
<span className="sr-only">GitHub Repo</span>
7676
<FontAwesomeIcon
77-
icon={socialIcon("github")}
77+
icon={socialIcon("github").icon}
7878
className="h-6 w-6"
7979
style={{ height: 25, width: 25 }}
8080
/>

src/components/list/Item.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ export default function Item({ data }) {
2222
)}
2323
{data.icon && (
2424
<FontAwesomeIcon
25-
icon={socialIcon(data.icon)}
25+
icon={socialIcon(data.icon).icon}
2626
className="h-12 w-12 flex-none rounded-full bg-gray-50 p-2"
27-
style={{ height: 50, width: 50 }}
27+
style={{
28+
height: 50,
29+
width: 50,
30+
color: socialIcon(data.icon).color,
31+
}}
2832
/>
2933
)}
3034
<div className="min-w-0 flex-auto">
@@ -43,16 +47,19 @@ export default function Item({ data }) {
4347
<div className="flex -space-x-0.5">
4448
<dt className="sr-only">Social platforms</dt>
4549
{data.socials &&
46-
data.socials.map((badge, key) => (
47-
<dd key={key}>
48-
<FontAwesomeIcon
49-
icon={socialIcon(badge.icon)}
50-
label={badge.icon}
51-
className="h-6 w-6 rounded-full bg-gray-50 ring-2 ring-white"
52-
style={{ height: 25, width: 25 }}
53-
/>
54-
</dd>
55-
))}
50+
data.socials.map((badge, key) => {
51+
const { icon, color } = socialIcon(badge.icon);
52+
return (
53+
<dd key={key}>
54+
<FontAwesomeIcon
55+
icon={icon}
56+
label={badge.icon}
57+
className="h-6 w-6 rounded-full bg-gray-50 ring-2 ring-white"
58+
style={{ height: 25, width: 25, color: color }}
59+
/>
60+
</dd>
61+
);
62+
})}
5663
<ChevronRightIcon
5764
className="h-5 w-5 flex-none text-gray-400 hidden sm:block"
5865
aria-hidden="true"

src/config/socialIcon.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,35 @@ import { faThumbsUp } from "@fortawesome/free-regular-svg-icons";
1111

1212
export default function socialIcon(name) {
1313
let icon = faThumbsUp;
14+
let color = "#000000";
1415
switch (name) {
1516
case "twitter":
1617
icon = faTwitter;
18+
color = "#1DA1F2";
1719
break;
1820
case "youtube":
1921
icon = faYoutube;
22+
color = "#FF0000";
2023
break;
2124
case "twitch":
2225
icon = faTwitch;
26+
color = " #6441A5";
2327
break;
2428
case "hashnode":
2529
icon = faHashnode;
30+
color = "#1DA1F2";
2631
break;
2732
case "devto":
2833
icon = faDev;
34+
color = "#0A0A0A";
2935
break;
3036
case "github":
3137
icon = faGithub;
38+
color = "#DAD7CB";
3239
break;
3340
case "medium":
3441
icon = faMedium;
3542
break;
3643
}
37-
return icon;
44+
return { icon, color };
3845
}

0 commit comments

Comments
 (0)