Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2178 from system-ui/update-example-custom-pragma
chore(examples): Upgrade custom pragma example
- Loading branch information
Showing
6 changed files
with
51 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import React from 'react' | ||
import { ThemeProvider, Themed } from 'theme-ui' | ||
import { ThemeProvider } from 'theme-ui' | ||
import theme from './theme' | ||
|
||
export const WrapRootElement = ({ element }) => ( | ||
<ThemeProvider theme={theme}> | ||
<Themed.root>{element}</Themed.root> | ||
</ThemeProvider> | ||
<ThemeProvider theme={theme}>{element}</ThemeProvider> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
/** @jsx jsx */ | ||
import { jsx, Layout, Header, Main, Container } from 'theme-ui' | ||
import { BaseStyles, jsx } from 'theme-ui' | ||
|
||
export default (props) => ( | ||
<Layout> | ||
<Header> | ||
<h2>Theme UI Gatsby Example</h2> | ||
</Header> | ||
<Main> | ||
<Container>{props.children}</Container> | ||
</Main> | ||
</Layout> | ||
const Layout = (props) => ( | ||
<BaseStyles> | ||
<article | ||
sx={{ | ||
maxWidth: 768, | ||
px: 2, | ||
py: 4, | ||
mx: 'auto', | ||
}} | ||
> | ||
{props.children} | ||
</article> | ||
</BaseStyles> | ||
) | ||
|
||
export default Layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
/** @jsx jsx */ | ||
import { jsx, Themed } from 'theme-ui' | ||
|
||
export default (props) => ( | ||
<div | ||
css={{ | ||
const Content = () => ( | ||
<article | ||
sx={{ | ||
fontFamily: 'body', | ||
lineHeight: 'body', | ||
color: 'text', | ||
bg: 'background', | ||
maxWidth: 768, | ||
px: 4, | ||
px: 2, | ||
py: 4, | ||
mx: 'auto', | ||
}}> | ||
}} | ||
> | ||
<h1 | ||
css={{ | ||
sx={{ | ||
fontSize: [4, 5, 6], | ||
}}> | ||
mb: 0, | ||
}} | ||
> | ||
Custom JSX pragma example | ||
</h1> | ||
<p> | ||
This page uses the Theme UI <Themed.code>css</Themed.code> prop with a | ||
This page uses the Theme UI <Themed.code>sx</Themed.code> prop with a | ||
custom JSX pragma that allows you to use theme-based values directly in | ||
the <Themed.code>css</Themed.code> prop with no additional imports. You | ||
can also use arrays as values to apply responsive styles to any CSS | ||
property. | ||
the <Themed.code>sx</Themed.code> prop with no additional imports. You can | ||
also use arrays as values to apply responsive styles to any CSS property. | ||
</p> | ||
</div> | ||
</article> | ||
) | ||
|
||
export default Content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters