Skip to content

Commit f993997

Browse files
committed
Get rid of dangerouslySetInnerHTML in Social image styles with the excellent hover-color suggestion from Cursor editor
1 parent be6655d commit f993997

File tree

2 files changed

+6
-39
lines changed

2 files changed

+6
-39
lines changed

components/Footer.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,12 @@ export function FooterImpl() {
4747
)}
4848
</div>
4949

50-
<style
51-
dangerouslySetInnerHTML={{
52-
__html: socialLinks.map((action) => (
53-
`.social-link-footer-${action.name} {}
54-
.social-link-footer-${action.name}:hover { color: ${action.color}; }
55-
`
56-
)).join('\n')
57-
}}
58-
/>
59-
6050
<div className={styles.social}>
6151
{socialLinks.map((action) => (
6252
<a
63-
className={cs(styles[action.name], `social-link-footer-${action.name}`)}
53+
key={action.name}
54+
style={{ '--hover-color': action.color } as React.CSSProperties}
55+
className={styles[action.name]}
6456
href={action.href}
6557
title={action.title}
6658
target='_blank'

components/styles.module.css

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -85,39 +85,14 @@
8585
.social a:hover {
8686
transition: color 50ms ease-out;
8787
}
88-
89-
.toggleDarkMode:hover {
90-
color: #2795e9;
88+
.social a:hover {
89+
color: var(--hover-color);
9190
}
9291

93-
.twitter:hover {
92+
.toggleDarkMode:hover {
9493
color: #2795e9;
9594
}
9695

97-
.mastodon:hover {
98-
color: #5a4be1;
99-
}
100-
101-
.zhihu:hover {
102-
color: #0066ff;
103-
}
104-
105-
.github:hover {
106-
color: #c9510c;
107-
}
108-
109-
.youtube:hover {
110-
color: #ff0000;
111-
}
112-
113-
.linkedin:hover {
114-
color: #0077b5;
115-
}
116-
117-
.newsletter:hover {
118-
color: #777777;
119-
}
120-
12196
.comments {
12297
width: 100%;
12398
margin-top: 2em;

0 commit comments

Comments
 (0)