Skip to content

Commit ff74ece

Browse files
authored
Removes styled system prop usage. (#301)
* Removes styled system prop usage. * Changeset
1 parent 29ec356 commit ff74ece

19 files changed

+101
-97
lines changed

.changeset/lemon-tomatoes-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/gatsby-theme-doctocat': patch
3+
---
4+
5+
Removed styled system prop usage on Primer React components.

theme/src/components/clipboard-copy.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ function ClipboardCopy({value}) {
2424
sx={{px: 2}}
2525
>
2626
{copied ? (
27-
<StyledOcticon icon={CheckIcon} color="success.fg" />
27+
<StyledOcticon icon={CheckIcon} sx={{color: 'success.fg'}} />
2828
) : (
29-
<StyledOcticon icon={CopyIcon} color="fg.muted" />
29+
<StyledOcticon icon={CopyIcon} sx={{color: 'fg.muted'}} />
3030
)}
3131
</Button>
3232
)

theme/src/components/code.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function Code({className, children, live, noinline}) {
2424
width: '100%'
2525
}}
2626
>
27-
<Absolute top={0} right={0} p={2}>
27+
<Absolute sx={{top: 0, right: 0, p: 2}}>
2828
<ClipboardCopy value={code} />
2929
</Absolute>
3030
<Highlight {...defaultProps} Prism={Prism} code={code} language={language} theme={githubTheme}>

theme/src/components/contributors.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ function Contributors({contributors}) {
2020
<Link
2121
key={contributor.login}
2222
href={`https://github.com/${contributor.login}`}
23-
lineHeight="condensedUltra"
24-
sx={{mr: 2}}
23+
sx={{mr: 2, lineHeight: 'condensedUltra'}}
2524
>
2625
<Tooltip key={contributor.login} aria-label={contributor.login}>
2726
<Avatar src={`https://github.com/${contributor.login}.png?size=40`} alt={contributor.login} />

theme/src/components/do-dont.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function DoDontBase({children, title, icon: Icon, iconBg}) {
2626
return (
2727
<Box display="flex" flexDirection="column">
2828
<Box display="flex" alignSelf="start" flexDirection="row" alignItems="center" mb="2">
29-
<StyledOcticon icon={Icon} color={iconBg} />
29+
<StyledOcticon icon={Icon} sx={{color: iconBg}} />
3030
<Text fontWeight="bold" color="fg.default" ml={2}>
3131
{title}
3232
</Text>

theme/src/components/drawer.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,8 @@ function Drawer({isOpen, onDismiss, children}) {
2323
animate={{opacity: 1}}
2424
exit={{opacity: 0}}
2525
transition={{type: 'tween'}}
26-
top={0}
27-
right={0}
28-
bottom={0}
29-
left={0}
30-
bg="rgba(0, 0, 0, 0.5)"
3126
onClick={() => onDismiss()}
27+
sx={{top: 0, right: 0, bottom: 0, left: 0, bg: 'rgba(0, 0, 0, 0.5)'}}
3228
/>
3329

3430
<Fixed
@@ -38,12 +34,8 @@ function Drawer({isOpen, onDismiss, children}) {
3834
animate={{x: 0}}
3935
exit={{x: '100%'}}
4036
transition={{type: 'tween', duration: 0.2}}
41-
width={300}
42-
top={0}
43-
right={0}
44-
bottom={0}
45-
bg="gray.0"
4637
style={{zIndex: 1}}
38+
sx={{width: 300, top: 0, right: 0, bottom: 0, bg: 'gray.0'}}
4739
>
4840
{children}
4941
</Fixed>

theme/src/components/hero-layout.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ function HeroLayout({children, pageContext}) {
1515
}
1616

1717
return (
18-
<Flex flexDirection="column" minHeight="100vh">
18+
<Flex sx={{flexDirection: 'column', minHeight: '100vh'}}>
1919
<Head />
2020
<Header />
21-
<Flex flex="1 1 auto" flexDirection="row">
21+
<Flex sx={{flex: '1 1 auto', flexDirection: 'row'}}>
2222
<Box display={['none', null, null, 'block']}>
2323
<Sidebar />
2424
</Box>

theme/src/components/hero.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function Hero() {
1010
<ThemeProvider colorMode="night" nightScheme="dark_dimmed">
1111
<Box bg="canvas.default" py={6}>
1212
<Container>
13-
<Heading as="h1" color="accent.fg" fontSize={7} m={0}>
13+
<Heading as="h1" sx={{color: 'accent.fg', fontSize: 7, m: 0}}>
1414
{title}
1515
</Heading>
1616
<Text as="p" m={0} color="fg.default" fontSize={4}>

theme/src/components/image-container.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ import React from 'react'
33

44
function ImageContainer({children}) {
55
return (
6-
<BorderBox p={6} bg="gray.1">
7-
<Flex justifyContent="center" sx={{img: {maxWidth: '100%'}}}>
8-
{children}
9-
</Flex>
6+
<BorderBox sx={{p: 6, bg: 'gray.1'}}>
7+
<Flex sx={{img: {maxWidth: '100%'}, justifyContent: 'center'}}>{children}</Flex>
108
</BorderBox>
119
)
1210
}

theme/src/components/layout.js

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ function Layout({children, pageContext}) {
2626
}
2727

2828
return (
29-
<Flex flexDirection="column" minHeight="100vh">
29+
<Flex sx={{flexDirection: 'column', minHeight: '100vh'}}>
3030
<Head title={title} description={description} />
3131
<Header />
32-
<Flex flex="1 1 auto" flexDirection="row" css={{zIndex: 0}}>
32+
<Flex css={{zIndex: 0}} sx={{flex: '1 1 auto', flexDirection: 'row'}}>
3333
<Box display={['none', null, null, 'block']}>
3434
<Sidebar />
3535
</Box>
@@ -45,12 +45,16 @@ function Layout({children, pageContext}) {
4545
>
4646
{pageContext.tableOfContents.items ? (
4747
<Position
48-
sx={{width: 220, flex: '0 0 auto', marginLeft: 6}}
49-
display={['none', null, 'block']}
48+
sx={{
49+
width: 220,
50+
flex: '0 0 auto',
51+
marginLeft: 6,
52+
display: ['none', null, 'block'],
53+
position: 'sticky',
54+
top: HEADER_HEIGHT + 48,
55+
maxHeight: `calc(100vh - ${HEADER_HEIGHT}px - 48px)`
56+
}}
5057
css={{gridArea: 'table-of-contents', overflow: 'auto'}}
51-
position="sticky"
52-
top={HEADER_HEIGHT + 48}
53-
maxHeight={`calc(100vh - ${HEADER_HEIGHT}px - 48px)`}
5458
>
5559
<Text display="inline-block" fontWeight="bold" mb={1}>
5660
On this page
@@ -61,7 +65,7 @@ function Layout({children, pageContext}) {
6165
<Box width="100%" maxWidth="960px">
6266
<Box mb={4}>
6367
<Flex sx={{alignItems: 'center'}}>
64-
<Heading as="h1" mr={2}>
68+
<Heading as="h1" sx={{mr: 2}}>
6569
{title}
6670
</Heading>{' '}
6771
{status ? <StatusLabel status={status} /> : null}
@@ -73,21 +77,25 @@ function Layout({children, pageContext}) {
7377
) : null}
7478
{source || storybook ? (
7579
<Grid
76-
py={2}
77-
gridGap={[1, null, 3]}
78-
gridAutoFlow={['row', null, 'column']}
79-
gridAutoColumns="max-content"
80-
gridAutoRows="max-content"
80+
sx={{
81+
py: 2,
82+
gridGap: [1, null, 3],
83+
gridAutoFlow: ['row', null, 'column'],
84+
gridAutoColumns: 'max-content',
85+
gridAutoRows: 'max-content'
86+
}}
8187
>
8288
{source ? <SourceLink href={source} /> : null}
8389
{storybook ? <StorybookLink href={storybook} /> : null}
8490
</Grid>
8591
) : null}
8692
</Box>
8793
{pageContext.tableOfContents.items ? (
88-
<BorderBox display={['block', null, 'none']} mb={5} borderColor="border.muted" bg="canvas.subtle">
94+
<BorderBox
95+
sx={{display: ['block', null, 'none'], mb: 5, borderColor: 'border.muted', bg: 'canvas.subtle'}}
96+
>
8997
<Box p={3}>
90-
<Flex flexDirection="row" justifyContent="space-between" alignItems="center">
98+
<Flex sx={{flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center'}}>
9199
<Text fontWeight="bold">On this page</Text>
92100
</Flex>
93101
</Box>

0 commit comments

Comments
 (0)