Skip to content

Commit

Permalink
Get rid of dangerouslySetInnerHTML in Social image styles with the ex…
Browse files Browse the repository at this point in the history
…cellent hover-color suggestion from Cursor editor
  • Loading branch information
onnimonni committed Nov 1, 2024
1 parent be6655d commit f993997
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 39 deletions.
14 changes: 3 additions & 11 deletions components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,12 @@ export function FooterImpl() {
)}
</div>

<style
dangerouslySetInnerHTML={{
__html: socialLinks.map((action) => (
`.social-link-footer-${action.name} {}
.social-link-footer-${action.name}:hover { color: ${action.color}; }
`
)).join('\n')
}}
/>

<div className={styles.social}>
{socialLinks.map((action) => (
<a
className={cs(styles[action.name], `social-link-footer-${action.name}`)}
key={action.name}
style={{ '--hover-color': action.color } as React.CSSProperties}
className={styles[action.name]}
href={action.href}
title={action.title}
target='_blank'
Expand Down
31 changes: 3 additions & 28 deletions components/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,39 +85,14 @@
.social a:hover {
transition: color 50ms ease-out;
}

.toggleDarkMode:hover {
color: #2795e9;
.social a:hover {
color: var(--hover-color);
}

.twitter:hover {
.toggleDarkMode:hover {
color: #2795e9;
}

.mastodon:hover {
color: #5a4be1;
}

.zhihu:hover {
color: #0066ff;
}

.github:hover {
color: #c9510c;
}

.youtube:hover {
color: #ff0000;
}

.linkedin:hover {
color: #0077b5;
}

.newsletter:hover {
color: #777777;
}

.comments {
width: 100%;
margin-top: 2em;
Expand Down

0 comments on commit f993997

Please sign in to comment.