Skip to content

Commit b087ad1

Browse files
committed
Added layout component
1 parent 7040074 commit b087ad1

File tree

7 files changed

+10616
-12630
lines changed

7 files changed

+10616
-12630
lines changed

gatsby-intro/gatsby-config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
plugins: ['gatsby-plugin-emotion'],
3+
};

gatsby-intro/package-lock.json

Lines changed: 0 additions & 12629 deletions
This file was deleted.

gatsby-intro/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
"react-dom": "^16.8.6"
1919
},
2020
"devDependencies": {
21+
"@emotion/core": "^10.0.22",
22+
"@emotion/styled": "^10.0.23",
2123
"cross-env": "^5.2.0",
24+
"gatsby-plugin-emotion": "^4.1.15",
2225
"prettier": "^1.18.2"
2326
},
2427
"repository": {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
3+
const Header = () => {
4+
<div>This is my header</div>;
5+
};
6+
7+
export default Header;
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import React from 'react';
2+
import { Global, css } from '@emotion/core';
3+
4+
const Layout = ({ children }) => {
5+
return (
6+
<>
7+
<Global
8+
styles={css`
9+
*,
10+
*:after,
11+
*:before {
12+
box-sizing: border-box;
13+
margin: 0;
14+
}
15+
16+
* + * {
17+
margin-top: 1rem;
18+
}
19+
20+
html,
21+
body {
22+
margin: 0;
23+
color: #555;
24+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
25+
Helvetica, Arial, sans-serif;
26+
font-size: 18px;
27+
line-height: 1.4;
28+
29+
> div {
30+
margin-top: 0;
31+
}
32+
}
33+
34+
h1,
35+
h2,
36+
h3,
37+
h4,
38+
h5,
39+
h6 {
40+
color: #222;
41+
line-height: 1.1;
42+
43+
+ * {
44+
margin-top: 0.5rem;
45+
}
46+
}
47+
48+
strong {
49+
color: #222;
50+
}
51+
52+
li {
53+
margin-top: 0.25rem;
54+
}
55+
`}
56+
/>
57+
<header></header>
58+
<main
59+
css={css`
60+
margin: 2rem auto 4rem;
61+
max-width: 90vw;
62+
width: 550px;
63+
`}
64+
>
65+
{children}
66+
</main>
67+
</>
68+
);
69+
};
70+
71+
export default Layout;

gatsby-intro/src/pages/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
import React from 'react';
2+
import Layout from '../components/Layout';
23

3-
export default () => <div>Hello Frontend Masters!</div>;
4+
export default () => (
5+
<Layout>
6+
<div>Frontend Masters!</div>
7+
</Layout>
8+
);

0 commit comments

Comments
 (0)