Skip to content

Commit d0c1f96

Browse files
authored
Merge pull request #7990 from Gift-Stack/social-list-item
Update: Migrate SocialListItem to Chakra
2 parents e775e4a + dda3766 commit d0c1f96

File tree

1 file changed

+44
-29
lines changed

1 file changed

+44
-29
lines changed

src/components/SocialListItem.tsx

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,57 @@
11
// Libraries
22
import React from "react"
3-
import styled from "@emotion/styled"
3+
import { Flex, Box, Icon } from "@chakra-ui/react"
4+
import {
5+
FaTwitter,
6+
FaYoutube,
7+
FaDiscord,
8+
FaRedditAlien,
9+
FaStackExchange,
10+
FaGlobe,
11+
} from "react-icons/fa"
412

5-
// Components
6-
import Icon from "./Icon"
7-
8-
// Styles
9-
const Item = styled.div`
10-
display: flex;
11-
width: 100%;
12-
padding: 0.5rem 0;
13-
align-items: center;
14-
`
15-
16-
const StyledIcon = styled(Icon)`
17-
padding-right: 0.75rem;
18-
`
19-
20-
const ChildrenContainer = styled.div`
21-
font-style: italic;
13+
const socialColors = {
14+
reddit: "#ff4301",
15+
twitter: "#1da1f2",
16+
youtube: "#ff0000",
17+
discord: "#7289da",
18+
stackExchange: "#48a2da",
19+
}
2220

23-
> a {
24-
font-style: normal;
25-
}
26-
`
21+
const icons = {
22+
reddit: FaRedditAlien,
23+
twitter: FaTwitter,
24+
youtube: FaYoutube,
25+
discord: FaDiscord,
26+
stackExchange: FaStackExchange,
27+
webpage: FaGlobe,
28+
}
2729

2830
export interface IProps {
2931
children?: React.ReactNode
30-
socialIcon: string
32+
socialIcon: keyof typeof icons
3133
}
34+
3235
const SocialListItem: React.FC<IProps> = ({ children, socialIcon }) => {
3336
return (
34-
<Item>
35-
<div>
36-
<StyledIcon name={socialIcon} size={"2.5rem"} color={true} />
37-
</div>
38-
<ChildrenContainer>{children}</ChildrenContainer>
39-
</Item>
37+
<Flex w="100%" py="2" px="0" align="center">
38+
<Icon
39+
as={icons[socialIcon]}
40+
pr={3}
41+
boxSize={10}
42+
color={socialColors[socialIcon]}
43+
/>
44+
<Box
45+
fontStyle="italic"
46+
sx={{
47+
"> a": {
48+
fontStyle: "normal",
49+
},
50+
}}
51+
>
52+
{children}
53+
</Box>
54+
</Flex>
4055
)
4156
}
4257

0 commit comments

Comments
 (0)