Skip to content

Commit c5a2361

Browse files
authored
Merge pull request #8501 from vdusart/feat/convert-Pill-component
convert the Pill component to Chakra
2 parents 074671b + c2d8d68 commit c5a2361

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

src/components/Pill.tsx

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,6 @@
11
import React from "react"
2-
import styled from "@emotion/styled"
2+
import { Flex } from "@chakra-ui/react"
33

4-
const Primary = styled.div<{ color?: string }>`
5-
display: flex;
6-
background: ${(props) =>
7-
props.color
8-
? props.theme.colors[props.color]
9-
: props.theme.colors.primary100};
10-
color: ${(props) => props.theme.colors.black300};
11-
text-transform: uppercase;
12-
text-align: center;
13-
display: inline-block;
14-
padding: 0.25rem 0.5rem;
15-
margin-right: 0.5rem;
16-
font-size: 0.75rem;
17-
border-radius: 0.25rem;
18-
`
19-
const Secondary = styled.div`
20-
display: flex;
21-
border: 1px solid ${(props) => props.theme.colors.primary100};
22-
color: ${(props) => props.theme.colors.text};
23-
text-transform: uppercase;
24-
text-align: center;
25-
display: inline-block;
26-
padding: 0.25rem 0.5rem;
27-
font-size: 0.75rem;
28-
border-radius: 0.25rem;
29-
`
304
export interface IProps {
315
children?: React.ReactNode
326
className?: string
@@ -41,11 +15,38 @@ const Pill: React.FC<IProps> = ({
4115
color,
4216
}) => {
4317
return isSecondary ? (
44-
<Secondary className={className}>{children}</Secondary>
18+
<Flex
19+
border="1px"
20+
borderStyle="solid"
21+
borderColor="primary100"
22+
color="text"
23+
textTransform="uppercase"
24+
textAlign="center"
25+
display="inline-block"
26+
py={1}
27+
px={2}
28+
borderRadius="base"
29+
fontSize="xs"
30+
className={className}
31+
>
32+
{children}
33+
</Flex>
4534
) : (
46-
<Primary color={color} className={className}>
35+
<Flex
36+
backgroundColor={color ? color : "primary"}
37+
display="inline-block"
38+
color="black300"
39+
textTransform="uppercase"
40+
textAlign="center"
41+
py={1}
42+
px={2}
43+
mr={2}
44+
fontSize="xs"
45+
borderRadius="base"
46+
className={className}
47+
>
4748
{children}
48-
</Primary>
49+
</Flex>
4950
)
5051
}
5152

0 commit comments

Comments
 (0)