File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change 1
1
import React from "react"
2
- import { Flex } from "@chakra-ui/react"
2
+ import { Flex , FlexProps } from "@chakra-ui/react"
3
3
4
- export interface IProps {
4
+ export interface IProps extends FlexProps {
5
5
children ?: React . ReactNode
6
6
className ?: string
7
7
isSecondary ?: boolean
@@ -12,7 +12,8 @@ const Pill: React.FC<IProps> = ({
12
12
children,
13
13
className,
14
14
isSecondary,
15
- color,
15
+ background,
16
+ ...rest
16
17
} ) => {
17
18
return isSecondary ? (
18
19
< Flex
@@ -28,12 +29,13 @@ const Pill: React.FC<IProps> = ({
28
29
borderRadius = "base"
29
30
fontSize = "xs"
30
31
className = { className }
32
+ { ...rest }
31
33
>
32
34
{ children }
33
35
</ Flex >
34
36
) : (
35
37
< Flex
36
- backgroundColor = { color ? color : "primary100" }
38
+ background = { background ?? "primary100" }
37
39
display = "inline-block"
38
40
color = "black300"
39
41
textTransform = "uppercase"
@@ -44,6 +46,7 @@ const Pill: React.FC<IProps> = ({
44
46
fontSize = "xs"
45
47
borderRadius = "base"
46
48
className = { className }
49
+ { ...rest }
47
50
>
48
51
{ children }
49
52
</ Flex >
Original file line number Diff line number Diff line change 1
1
import React from "react"
2
- import styled from "@emotion/styled"
3
2
4
3
import Pill from "./Pill"
5
4
@@ -27,12 +26,6 @@ const colors = [
27
26
"tagPink" ,
28
27
] as const
29
28
30
- const TagPill = styled ( Pill ) `
31
- margin-right: 0.5rem;
32
- margin-bottom: 0.5rem;
33
- background-color: ${ ( props ) => props . theme . colors [ props . color ! ] } ;
34
- `
35
-
36
29
export interface IProps {
37
30
tags : Array < string >
38
31
}
@@ -44,9 +37,9 @@ const TutorialTags: React.FC<IProps> = ({ tags }) => {
44
37
const tagColorIdx = hashCode ( tag ) % colors . length
45
38
const tagColor = colors [ tagColorIdx ]
46
39
return (
47
- < TagPill key = { idx } color = { tagColor } >
40
+ < Pill key = { idx } me = { 2 } mb = { 2 } background = { tagColor } >
48
41
{ tag }
49
- </ TagPill >
42
+ </ Pill >
50
43
)
51
44
} ) }
52
45
</ >
You can’t perform that action at this time.
0 commit comments