Skip to content

Commit aa75868

Browse files
committed
WIP: Continue to refactor Social links and add more fun background
1 parent dcfd122 commit aa75868

File tree

2 files changed

+24
-82
lines changed

2 files changed

+24
-82
lines changed

components/PageSocial.module.css

Lines changed: 10 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,10 @@
66
color: var(--fg-color);
77
}
88

9-
.socialLink:hover {
10-
border-radius: 50%;
11-
color: var(--hover-color);
12-
background: var(--hover-background);
13-
}
14-
15-
.pageSocial .actionBgPane {
16-
background: var(--hover-color);
17-
}
18-
19-
.pageSocial .socialLink:hover {
20-
color: var(--fg-color);
21-
border-color: var(--hover-color);;
22-
}
23-
24-
.action {
9+
.pageSocial a {
2510
position: relative;
2611
border-radius: 50%;
2712
border: 2px solid var(--fg-color-6);
28-
transition: all 300ms ease-out;
2913
width: 3.5em;
3014
height: 3.5em;
3115
margin: 0 0 1em;
@@ -38,52 +22,21 @@
3822
cursor: pointer;
3923
}
4024

41-
.action:last-child {
42-
margin-bottom: 0;
25+
.pageSocial a:hover {
26+
border: 2px solid var(--hover-background);
4327
}
4428

45-
.actionBg {
46-
position: absolute;
47-
top: 0;
48-
left: 0;
49-
right: 0;
50-
bottom: 0;
51-
52-
display: flex;
53-
flex-direction: column;
54-
justify-content: center;
55-
align-items: center;
56-
}
57-
58-
.actionBg svg {
59-
width: 50%;
60-
height: 50%;
61-
fill: var(--fg-color-6);
29+
.socialLink {
30+
transition: all 500ms ease-out;
6231
}
6332

64-
.actionBgPane {
65-
transition: all 300ms ease-out;
33+
.socialLink:hover {
6634
border-radius: 50%;
67-
width: 0;
68-
height: 0;
69-
}
70-
71-
.action:hover {
72-
transition: all 100ms ease-out;
73-
}
74-
75-
.action:hover .actionBgPane {
76-
width: 100%;
77-
height: 100%;
78-
transition: all 100ms ease-out;
79-
}
80-
81-
.action:hover svg {
82-
transition: fill 100ms ease-out;
83-
fill: var(--bg-color);
35+
color: var(--hover-color);
36+
background: var(--hover-background);
8437
}
8538

86-
:global(.dark-mode) .action:hover svg {
39+
:global(.dark-mode) .socialLink:hover svg {
8740
fill: var(--fg-color);
8841
}
8942

@@ -94,7 +47,7 @@
9447
flex-wrap: wrap;
9548
}
9649

97-
.action:last-child {
50+
.pageSocial a:last-child {
9851
margin-right: 1em;
9952
}
10053
}

components/PageSocial.tsx

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export const socialLinks: SocialLink[] = [
2323
name: 'twitter',
2424
href: `https://twitter.com/${config.twitter}`,
2525
title: `Twitter @${config.twitter}`,
26-
color: "#2795e9",
26+
color: "#ffffff",
27+
background: "#2795e9",
2728
icon: FaTwitter
2829
},
2930
config.twitterX && {
@@ -46,7 +47,11 @@ export const socialLinks: SocialLink[] = [
4647
name: 'github',
4748
href: `https://github.com/${config.github}`,
4849
title: `GitHub @${config.github}`,
49-
color: "#c9510c",
50+
// FIXME: Figure out great way to preserve github black and white theme, For now it uses rainbow
51+
color: "#ffffff",
52+
// Fun rainbow background, similarl as their pride logo
53+
// FIXME: Gradients can't be transitioned with css :(
54+
background: "linear-gradient(to bottom, #C6474E 0%, #C6474E 17%, #D67940 17%, #D67940 33%, #F8D45C 33%, #F8D45C 50%, #67A25A 50%, #67A25A 67%, #3A63C7 67%, #3A63C7 84%, #6446B4 84%)",
5055
icon: FaGithub
5156
},
5257

@@ -62,7 +67,8 @@ export const socialLinks: SocialLink[] = [
6267
name: 'linkedin',
6368
href: `https://www.linkedin.com/in/${config.linkedin}`,
6469
title: `LinkedIn ${config.author}`,
65-
color: "#0077b5",
70+
color: "#ffffff",
71+
background: "#0077b5",
6672
icon: FaLinkedin
6773
},
6874

@@ -95,7 +101,8 @@ export const socialLinks: SocialLink[] = [
95101
name: 'reddit',
96102
href: `https://www.reddit.com/u/${config.reddit}`,
97103
title: `Reddit @${config.reddit}`,
98-
color: "#ff0000",
104+
color: "#ffffff",
105+
background: "#FF5700",
99106
icon: FaReddit
100107
},
101108

@@ -112,31 +119,13 @@ export function PageSocial() {
112119
return (
113120
<>
114121
<div className={styles.pageSocial}>
115-
{socialLinks.map((action) => (
116-
<>
117-
<a
118-
key={action.name}
119-
style={{ '--hover-color': action.color } as React.CSSProperties}
120-
className={cs(styles.action, styles[action.name], styles.socialLink)}
121-
href={action.href}
122-
title={action.title}
123-
target='_blank'
124-
rel='noopener noreferrer'
125-
>
126-
<div className={styles.actionBg}>
127-
<div className={styles.actionBgPane} style={{ background: action.background } as React.CSSProperties} />
128-
</div>
129-
130-
<div className={styles.actionBg}>{action.icon({ size: 24 })}</div>
131-
</a>
132-
</>
133-
))}
122+
<PageSocialButtons iconSize={24} />
134123
</div>
135124
</>
136125
)
137126
}
138127

139-
export function PageSocialButtons() {
128+
export function PageSocialButtons({ iconSize = 32 }: { iconSize: number }) {
140129
return (
141130
<>
142131
{socialLinks.map((action) => (
@@ -149,7 +138,7 @@ export function PageSocialButtons() {
149138
target='_blank'
150139
rel='noopener noreferrer'
151140
>
152-
{action.icon({ size: 32 })}
141+
{action.icon({ size: iconSize })}
153142
</a>
154143
))}
155144
</>

0 commit comments

Comments
 (0)