Skip to content

Commit 6dd62ea

Browse files
committed
Add demo
1 parent c165022 commit 6dd62ea

File tree

6 files changed

+35
-21
lines changed

6 files changed

+35
-21
lines changed

Diff for: README.md

+2-7
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,9 @@ yarn type-check
2626
yarn build
2727
```
2828

29-
### Example
29+
### Demo
3030

31-
<img width="949" alt="screen shot 2019-01-26 at 12 16 13 pm" src="https://user-images.githubusercontent.com/236943/51792329-4b94cd00-2164-11e9-8228-7ed8b4a37afa.png">
32-
33-
<br />
34-
<br />
35-
36-
<img width="949" alt="screen shot 2019-01-26 at 12 16 02 pm" src="https://user-images.githubusercontent.com/236943/51792330-50598100-2164-11e9-9f3a-0f7189ffe5a5.png">
31+
![demo](https://user-images.githubusercontent.com/236943/51792565-abd93e00-2167-11e9-8bcb-87f7dccece52.gif)
3732

3833
<details>
3934
<summary>Gatsby API Details</summary>

Diff for: content/mdx/another-entry.mdx

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Another entry
3+
---
4+
<Button bg="blue">Hello page 2</Button>
5+
6+
### And it works :)

Diff for: content/mdx/hello.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ title: 'Edit mdx in NetlifyCMS! '
33
---
44
### This
55

6-
<h1>is some jsx 2</h1>
6+
<h1>is some jsx</h1>
77

8-
<Button bg='green'>Hi Button</Button>
8+
<Button bg='orange'>Hello Button</Button>

Diff for: src/Theme.jsx

+21-10
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,42 @@
44
* Since this file is shared with NetlifyCMS it must be .jsx
55
*/
66

7-
import React from "react"
8-
import styled, { ThemeProvider } from "styled-components"
7+
import React, { Fragment } from "react"
8+
import styled, { ThemeProvider, createGlobalStyle } from "styled-components"
99
import { Button } from "rebass"
1010

1111
export const theme = {
1212
// TODO: https://rebassjs.org/theming
1313
}
1414

15-
const H1 = styled.h1`
16-
font-size: 20px;
17-
`
15+
const GlobalStyle = createGlobalStyle`
16+
html, body {
17+
font-family: Arial, Helvetica, sans-serif;
18+
}
1819
19-
const P = styled.div`
20-
font-size: 16px;
20+
h3 {
21+
font-family: Arial, Helvetica, sans-serif
22+
}
2123
`
2224

2325
export const LayoutComponents = {
24-
h1: H1,
25-
p: P,
26+
h1: styled.h1`
27+
font-size: 20px;
28+
`,
29+
p: styled.p`
30+
font-size: 16px;
31+
`,
2632
}
2733

2834
export const UIComponents = {
2935
Button: props => <Button {...props}>{props.children}</Button>,
3036
}
3137

3238
export const Theme = ({ children }) => (
33-
<ThemeProvider theme={theme}>{children}</ThemeProvider>
39+
<ThemeProvider theme={theme}>
40+
<Fragment>
41+
<GlobalStyle />
42+
{children}
43+
</Fragment>
44+
</ThemeProvider>
3445
)

Diff for: src/cms/cms.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ const PreviewWindow = props => {
5454

5555
return (
5656
<StyleSheetManager target={iframeHeadElem}>
57-
<MdxPreview mdx={mdxProps} {...props} />
57+
<Theme>
58+
<MdxPreview mdx={mdxProps} {...props} />
59+
</Theme>
5860
</StyleSheetManager>
5961
)
6062
}

Diff for: static/admin/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ backend:
1010
repo: damassi/gatsby-typescript-netlify-starter
1111
branch: master
1212

13-
display_url: Gatsby Starter
13+
display_url: http://localhost:8000
1414
media_folder: static/assets
1515
public_folder: assets
1616

0 commit comments

Comments
 (0)