Skip to content

Commit 5b9ac7b

Browse files
committed
refactor: style icons with tailwind
1 parent c8d407a commit 5b9ac7b

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

src/components/SocialListItem.tsx

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import {
66
FaXTwitter,
77
FaYoutube,
88
} from "react-icons/fa6"
9-
import { Icon } from "@chakra-ui/react"
109

11-
const socialColors = {
12-
reddit: "#ff4301",
13-
twitter: "#1da1f2",
14-
youtube: "#ff0000",
15-
discord: "#7289da",
16-
stackExchange: "#48a2da",
10+
import { cn } from "@/lib/utils/cn"
11+
12+
const socialColorClasses = {
13+
reddit: "text-[#ff4301]",
14+
twitter: "text-[#1da1f2]",
15+
youtube: "text-[#ff0000]",
16+
discord: "text-[#7289da]",
17+
stackExchange: "text-[#48a2da]",
1718
}
1819

1920
const icons = {
@@ -25,28 +26,22 @@ const icons = {
2526
webpage: FaGlobe,
2627
}
2728

28-
type SocialListItemProps = {
29-
children?: React.ReactNode
29+
type SocialListItemProps = React.HTMLAttributes<HTMLDivElement> & {
3030
socialIcon: keyof typeof icons
31-
color?: string
32-
boxSize?: number
3331
}
3432

3533
const SocialListItem = ({
3634
children,
3735
socialIcon,
38-
color,
39-
boxSize = 10,
40-
}: SocialListItemProps) => (
41-
<div className="flex w-full items-center px-0 py-2">
42-
<Icon
43-
as={icons[socialIcon]}
44-
pe={3}
45-
boxSize={boxSize}
46-
color={color || socialColors[socialIcon]}
47-
/>
48-
<div className="font-normal italic">{children}</div>
49-
</div>
50-
)
36+
className,
37+
}: SocialListItemProps) => {
38+
const Icon = icons[socialIcon]
39+
return (
40+
<div className={cn("flex w-full items-center px-0 py-2", className)}>
41+
<Icon className={cn("size-10 pe-3", socialColorClasses[socialIcon])} />
42+
<div className="font-normal italic">{children}</div>
43+
</div>
44+
)
45+
}
5146

5247
export default SocialListItem

0 commit comments

Comments
 (0)