Skip to content

Commit 055fc38

Browse files
chore(www): convert badge component to theme-ui (gatsbyjs#24817)
* convert badge component to theme-ui * cleaned up the badge component * cleanup
1 parent 8741f06 commit 055fc38

File tree

4 files changed

+27
-43
lines changed

4 files changed

+27
-43
lines changed
+24-40
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,28 @@
1-
import React from "react"
2-
import styled from "@emotion/styled"
3-
import { border, typography, compose } from "styled-system"
4-
import propTypes from "@styled-system/prop-types"
1+
/** @jsx jsx */
2+
import { jsx } from "theme-ui"
53

6-
import { Flex } from "./system"
7-
8-
const styleProps = compose(border, typography)
9-
10-
const BadgeBase = styled(Flex)(
11-
{
12-
display: `inline-flex`,
13-
position: `relative`,
14-
textTransform: `uppercase`,
15-
},
16-
styleProps
17-
)
18-
19-
BadgeBase.propTypes = {
20-
...propTypes.border,
21-
...propTypes.typography,
22-
}
23-
24-
BadgeBase.defaultProps = {
25-
alignItems: `center`,
26-
bg: `yellow.10`,
27-
border: 1,
28-
borderColor: `yellow.10`,
29-
borderRadius: 5,
30-
color: `yellow.90`,
31-
fontFamily: `body`,
32-
fontSize: 0,
33-
fontWeight: `body`,
34-
letterSpacing: `tracked`,
35-
lineHeight: `solid`,
36-
py: 1,
37-
px: 2,
38-
}
39-
40-
const Badge = ({ children, ...rest }) => (
41-
<BadgeBase {...rest}>{children}</BadgeBase>
4+
const Badge = ({ children }) => (
5+
<div
6+
sx={{
7+
display: `inline-flex`,
8+
alignItems: `center`,
9+
position: `relative`,
10+
fontSize: 0,
11+
letterSpacing: `tracked`,
12+
textTransform: `uppercase`,
13+
lineHeight: `solid`,
14+
color: `yellow.90`,
15+
bg: `yellow.10`,
16+
border: 1,
17+
borderColor: `yellow.10`,
18+
borderRadius: 5,
19+
py: 1,
20+
px: 2,
21+
my: 3,
22+
}}
23+
>
24+
{children}
25+
</div>
4226
)
4327

4428
export default Badge

www/src/pages/guidelines/color.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const Color = props => {
6868
consistent experiences and meaningful expressions across marketing and
6969
products.
7070
</Intro>
71-
<Badge my={3}>
71+
<Badge>
7272
Work in Progress{` `}
7373
<MdWarning style={{ fontSize: 16, marginLeft: `0.25rem` }} />
7474
</Badge>

www/src/pages/guidelines/design-tokens.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const DesignTokens = ({ location }) => (
100100
This page collects all design tokens currently available for
101101
gatsbyjs.org which are not covered on sibling pages.
102102
</Intro>
103-
<Badge my={3}>
103+
<Badge>
104104
Work in Progress{` `}
105105
<MdWarning style={{ fontSize: 16, marginLeft: `0.25rem` }} />
106106
</Badge>

www/src/pages/guidelines/typography.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const Typography = ({ location }) => (
120120
organizations, and purposeful alignments that guide the user through
121121
content, product, and experience.
122122
</Intro>
123-
<Badge my={3}>
123+
<Badge>
124124
Work in Progress{` `}
125125
<MdWarning style={{ fontSize: 16, marginLeft: `0.25rem` }} />
126126
</Badge>

0 commit comments

Comments
 (0)