Skip to content

Commit 2be7b3a

Browse files
authored
Merge pull request #32 from binhtran432k/fix/social-icon
fix(social): use manual icon instead of plugin
2 parents bc3fa93 + d3ed9b6 commit 2be7b3a

File tree

5 files changed

+142
-23
lines changed

5 files changed

+142
-23
lines changed

bun.lockb

-384 Bytes
Binary file not shown.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"vite-tsconfig-paths": "^4.2.1"
4949
},
5050
"dependencies": {
51-
"@qwikest/icons": "^0.0.13",
5251
"clsx": "^2.1.0"
5352
}
5453
}

src/components/icon/icon.tsx

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
import { type QwikIntrinsicElements } from "@builder.io/qwik";
2+
3+
export function SimpleIconsGithub(
4+
props: QwikIntrinsicElements["svg"],
5+
key: string,
6+
) {
7+
return (
8+
<svg
9+
xmlns="http://www.w3.org/2000/svg"
10+
width="1em"
11+
height="1em"
12+
viewBox="0 0 24 24"
13+
{...props}
14+
key={key}
15+
>
16+
<path
17+
fill="currentColor"
18+
d="M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"
19+
></path>
20+
</svg>
21+
);
22+
}
23+
24+
export function SimpleIconsLinkedin(
25+
props: QwikIntrinsicElements["svg"],
26+
key: string,
27+
) {
28+
return (
29+
<svg
30+
xmlns="http://www.w3.org/2000/svg"
31+
width="1em"
32+
height="1em"
33+
viewBox="0 0 24 24"
34+
{...props}
35+
key={key}
36+
>
37+
<path
38+
fill="currentColor"
39+
d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037c-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85c3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065a2.064 2.064 0 1 1 2.063 2.065m1.782 13.019H3.555V9h3.564zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0z"
40+
></path>
41+
</svg>
42+
);
43+
}
44+
45+
export function SimpleIconsX(props: QwikIntrinsicElements["svg"], key: string) {
46+
return (
47+
<svg
48+
xmlns="http://www.w3.org/2000/svg"
49+
width="1em"
50+
height="1em"
51+
viewBox="0 0 24 24"
52+
{...props}
53+
key={key}
54+
>
55+
<path
56+
fill="currentColor"
57+
d="M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584l-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z"
58+
></path>
59+
</svg>
60+
);
61+
}
62+
63+
export function SimpleIconsYoutube(
64+
props: QwikIntrinsicElements["svg"],
65+
key: string,
66+
) {
67+
return (
68+
<svg
69+
xmlns="http://www.w3.org/2000/svg"
70+
width="1em"
71+
height="1em"
72+
viewBox="0 0 24 24"
73+
{...props}
74+
key={key}
75+
>
76+
<path
77+
fill="currentColor"
78+
d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814M9.545 15.568V8.432L15.818 12z"
79+
></path>
80+
</svg>
81+
);
82+
}
83+
84+
export function SimpleIconsInstagram(
85+
props: QwikIntrinsicElements["svg"],
86+
key: string,
87+
) {
88+
return (
89+
<svg
90+
xmlns="http://www.w3.org/2000/svg"
91+
width="1em"
92+
height="1em"
93+
viewBox="0 0 24 24"
94+
{...props}
95+
key={key}
96+
>
97+
<path
98+
fill="currentColor"
99+
d="M7.03.084c-1.277.06-2.149.264-2.91.563a5.874 5.874 0 0 0-2.124 1.388a5.878 5.878 0 0 0-1.38 2.127C.321 4.926.12 5.8.064 7.076C.008 8.354-.005 8.764.001 12.023c.007 3.259.021 3.667.083 4.947c.061 1.277.264 2.149.563 2.911c.308.789.72 1.457 1.388 2.123a5.872 5.872 0 0 0 2.129 1.38c.763.295 1.636.496 2.913.552c1.278.056 1.689.069 4.947.063c3.257-.007 3.668-.021 4.947-.082c1.28-.06 2.147-.265 2.91-.563a5.881 5.881 0 0 0 2.123-1.388a5.881 5.881 0 0 0 1.38-2.129c.295-.763.496-1.636.551-2.912c.056-1.28.07-1.69.063-4.948c-.006-3.258-.02-3.667-.081-4.947c-.06-1.28-.264-2.148-.564-2.911a5.892 5.892 0 0 0-1.387-2.123a5.857 5.857 0 0 0-2.128-1.38c-.764-.294-1.636-.496-2.914-.55C15.647.009 15.236-.006 11.977 0C8.718.008 8.31.021 7.03.084m.14 21.693c-1.17-.05-1.805-.245-2.228-.408a3.736 3.736 0 0 1-1.382-.895a3.695 3.695 0 0 1-.9-1.378c-.165-.423-.363-1.058-.417-2.228c-.06-1.264-.072-1.644-.08-4.848c-.006-3.204.006-3.583.061-4.848c.05-1.169.246-1.805.408-2.228c.216-.561.477-.96.895-1.382a3.705 3.705 0 0 1 1.379-.9c.423-.165 1.057-.361 2.227-.417c1.265-.06 1.644-.072 4.848-.08c3.203-.006 3.583.006 4.85.062c1.168.05 1.804.244 2.227.408c.56.216.96.475 1.382.895c.421.42.681.817.9 1.378c.165.422.362 1.056.417 2.227c.06 1.265.074 1.645.08 4.848c.005 3.203-.006 3.583-.061 4.848c-.051 1.17-.245 1.805-.408 2.23c-.216.56-.477.96-.896 1.38a3.705 3.705 0 0 1-1.378.9c-.422.165-1.058.362-2.226.418c-1.266.06-1.645.072-4.85.079c-3.204.007-3.582-.006-4.848-.06m9.783-16.192a1.44 1.44 0 1 0 1.437-1.442a1.44 1.44 0 0 0-1.437 1.442M5.839 12.012a6.161 6.161 0 1 0 12.323-.024a6.162 6.162 0 0 0-12.323.024M8 12.008A4 4 0 1 1 12.008 16A4 4 0 0 1 8 12.008"
100+
></path>
101+
</svg>
102+
);
103+
}
104+
105+
export function SimpleIconsFacebook(
106+
props: QwikIntrinsicElements["svg"],
107+
key: string,
108+
) {
109+
return (
110+
<svg
111+
xmlns="http://www.w3.org/2000/svg"
112+
width="1em"
113+
height="1em"
114+
viewBox="0 0 24 24"
115+
{...props}
116+
key={key}
117+
>
118+
<path
119+
fill="currentColor"
120+
d="M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978c.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036a26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103l-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647"
121+
></path>
122+
</svg>
123+
);
124+
}

src/components/social/social-link.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { type JSXNode, component$ } from "@builder.io/qwik";
1+
import { component$, type JSXOutput } from "@builder.io/qwik";
22
import { Link } from "@builder.io/qwik-city";
33

44
export default component$(
5-
({ label, href, icon }: { label: string; href: string; icon: JSXNode }) => {
5+
({ label, href, icon }: { label: string; href: string; icon: JSXOutput }) => {
66
return (
77
<div class="group relative flex place-items-center">
88
<span class="absolute left-0 top-0 origin-[38%48%] text-info group-hover:animate-spin group-hover:[animation-duration:200ms]">

src/components/social/social.tsx

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { type JSXNode, component$ } from "@builder.io/qwik";
1+
import { component$, type JSXOutput } from "@builder.io/qwik";
22
import {
3-
SiFacebook,
4-
SiGithub,
5-
SiInstagram,
6-
SiLinkedin,
7-
SiX,
8-
SiYoutube,
9-
} from "@qwikest/icons/simpleicons";
3+
SimpleIconsFacebook,
4+
SimpleIconsGithub,
5+
SimpleIconsInstagram,
6+
SimpleIconsLinkedin,
7+
SimpleIconsX,
8+
SimpleIconsYoutube,
9+
} from "../icon/icon";
1010
import SocialLink from "./social-link";
1111

1212
const socials = {
@@ -23,22 +23,18 @@ export default component$(() => {
2323
<ul class="container m-auto flex flex-wrap justify-center gap-4 px-2 py-4">
2424
{(
2525
[
26-
["Linkedin", socials.linkedin, SiLinkedin],
27-
["Github", socials.github, SiGithub],
28-
["Instagram", socials.instagram, SiInstagram],
29-
["X", socials.x, SiX],
30-
["Facebook", socials.facebook, SiFacebook],
31-
["Youtube", socials.youtube, SiYoutube],
32-
] as [string, string, (props: any) => JSXNode][]
26+
["Linkedin", socials.linkedin, SimpleIconsLinkedin],
27+
["Github", socials.github, SimpleIconsGithub],
28+
["Instagram", socials.instagram, SimpleIconsInstagram],
29+
["X", socials.x, SimpleIconsX],
30+
["Facebook", socials.facebook, SimpleIconsFacebook],
31+
["Youtube", socials.youtube, SimpleIconsYoutube],
32+
] as [string, string, () => JSXOutput][]
3333
)
3434
.filter(([, x]) => Boolean(x))
3535
.map(([label, href, Icon]) => (
3636
<li key={label} class="text-3xl">
37-
<SocialLink
38-
label={label}
39-
href={href}
40-
icon={(<Icon />) as JSXNode}
41-
/>
37+
<SocialLink label={label} href={href} icon={<Icon />} />
4238
</li>
4339
))}
4440
</ul>

0 commit comments

Comments
 (0)