File tree Expand file tree Collapse file tree 3 files changed +47
-13
lines changed
Expand file tree Collapse file tree 3 files changed +47
-13
lines changed Original file line number Diff line number Diff line change 11import LogoIcon from "@/components/icons/Logo" ;
22import NewsletterPopover from "@/components/ui/$NewsletterPopover" ;
3+ import SimpleIcon from "@/components/ui/SimpleIcon" ;
34import { GITHUB_URL , TELEGRAM_GROUP_LINK , TWITTER_ID } from "@/const" ;
45
56export default function Footer ( ) {
@@ -12,9 +13,9 @@ export default function Footer() {
1213 target = "_blank"
1314 rel = "noopener noreferrer"
1415 >
15- < img
16- class = "w-4 h-4"
17- src = "https://cdn.simpleicons.org/x/eee?viewbox=auto "
16+ < SimpleIcon
17+ klass = "w-4 h-4"
18+ src = "https://cdn.simpleicons.org/x"
1819 alt = "X"
1920 />
2021 </ a >
@@ -25,18 +26,18 @@ export default function Footer() {
2526 target = "_blank"
2627 rel = "noopener noreferrer"
2728 >
28- < img
29- class = "w-4 h-4"
30- src = "https://cdn.simpleicons.org/telegram/eee?viewbox=auto "
29+ < SimpleIcon
30+ klass = "w-4 h-4"
31+ src = "https://cdn.simpleicons.org/telegram"
3132 alt = "Telegram"
3233 />
3334 </ a >
3435 </ li >
3536 < li >
3637 < a href = { GITHUB_URL } target = "_blank" rel = "noopener noreferrer" >
37- < img
38- class = "w-4 h-4"
39- src = "https://cdn.simpleicons.org/github/eee?viewbox=auto "
38+ < SimpleIcon
39+ klass = "w-4 h-4"
40+ src = "https://cdn.simpleicons.org/github"
4041 alt = "github"
4142 />
4243 </ a >
Original file line number Diff line number Diff line change 11import { useState } from "hono/jsx" ;
2+ import SimpleIcon from "@/components/ui/SimpleIcon" ;
23
34const target = "newsletter" ;
45
@@ -72,10 +73,10 @@ export default function NewsletterDialog() {
7273 type = "button"
7374 class = "hover:text-secondary"
7475 >
75- < img
76- class = "w-4 h-4"
77- src = "https://cdn.simpleicons.org/substack/eee?viewbox=auto "
78- alt = "github "
76+ < SimpleIcon
77+ klass = "w-4 h-4"
78+ src = "https://cdn.simpleicons.org/substack"
79+ alt = "substack "
7980 />
8081 </ button >
8182 < div
Original file line number Diff line number Diff line change 1+ export default function SimpleIcon ( {
2+ src,
3+ alt,
4+ klass = "w-4 h-4" ,
5+ } : {
6+ src : string ;
7+ alt : string ;
8+ klass ?: string ;
9+ } ) {
10+ // Remove query params or color paths if present to get clean SVG content for masking
11+ // actually, keeping query params like viewbox=auto is fine, but we should strip colors if the user passes them by mistake.
12+ // For this implementation, we assume the user (me) will pass the clean URL.
13+
14+ return (
15+ < div
16+ aria-label = { alt }
17+ role = "img"
18+ class = { `${ klass } bg-current` }
19+ style = { {
20+ maskImage : `url('${ src } ')` ,
21+ maskRepeat : "no-repeat" ,
22+ maskPosition : "center" ,
23+ maskSize : "contain" ,
24+ WebkitMaskImage : `url('${ src } ')` ,
25+ WebkitMaskRepeat : "no-repeat" ,
26+ WebkitMaskPosition : "center" ,
27+ WebkitMaskSize : "contain" ,
28+ backgroundColor : "currentColor" ,
29+ } }
30+ />
31+ ) ;
32+ }
You can’t perform that action at this time.
0 commit comments