Skip to content

Commit 33d2cb4

Browse files
committed
setup styled components
1 parent 1198581 commit 33d2cb4

File tree

5 files changed

+2666
-1144
lines changed

5 files changed

+2666
-1144
lines changed

gatsby-config.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ module.exports = {
44
siteMetadata: {
55
title: `designsystems.dev`,
66
siteUrl: `https://designsystems.dev`,
7-
description: `Tools and resources for developing design systems.`
7+
description: `Tools and resources for developing design systems.`,
88
},
99
plugins: [
10+
'gatsby-plugin-styled-components',
11+
{
12+
resolve: 'gatsby-plugin-layout',
13+
options: {
14+
component: require.resolve('./src/components/Layout'),
15+
},
16+
},
1017
{
1118
resolve: `gatsby-source-airtable`,
1219
options: {
@@ -15,10 +22,10 @@ module.exports = {
1522
{
1623
baseId: 'appj22sdZFlI6FzjI',
1724
tableName: 'Table 1',
18-
queryName: 'data'
19-
}
20-
]
21-
}
22-
}
23-
]
25+
queryName: 'data',
26+
},
27+
],
28+
},
29+
},
30+
],
2431
}

package.json

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@
1313
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\""
1414
},
1515
"dependencies": {
16-
"gatsby": "2.13.57",
17-
"gatsby-source-airtable": "2.0.8",
18-
"gatsby-source-filesystem": "2.1.9",
19-
"react": "16.9.0",
20-
"react-dom": "16.9.0"
16+
"@chasemccoy/kit": "0.7.6",
17+
"babel-plugin-styled-components": "1.10.6",
18+
"gatsby": "2.15.29",
19+
"gatsby-plugin-layout": "1.1.10",
20+
"gatsby-plugin-styled-components": "3.1.8",
21+
"gatsby-source-airtable": "2.0.9",
22+
"gatsby-source-filesystem": "^2.1.29",
23+
"react": "16.10.2",
24+
"react-dom": "16.10.2",
25+
"styled-components": "^4.4.0"
2126
},
2227
"devDependencies": {
28+
"husky": "3.0.8",
29+
"lint-staged": "9.4.1",
2330
"prettier": "1.18.2"
2431
},
2532
"repository": {
@@ -28,5 +35,16 @@
2835
},
2936
"bugs": {
3037
"url": "https://github.com/chasemccoy/designsystems.dev/issues"
38+
},
39+
"husky": {
40+
"hooks": {
41+
"pre-commit": "PATH=$PATH lint-staged"
42+
}
43+
},
44+
"lint-staged": {
45+
"*.{js,jsx}": [
46+
"prettier --write",
47+
"git add"
48+
]
3149
}
3250
}

src/components/Layout.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import React from 'react'
2+
import { ThemeProvider, createGlobalStyle } from 'styled-components'
3+
import theme from '../utils/theme'
4+
import { CSSReset } from '@chasemccoy/kit'
5+
6+
const GlobalStyles = createGlobalStyle`
7+
body {
8+
font-size: 18px;
9+
font-family: ${p => p.theme.fonts.system};
10+
}
11+
`
12+
13+
const Layout = ({ children }) => {
14+
return (
15+
<ThemeProvider theme={theme}>
16+
<CSSReset />
17+
<GlobalStyles />
18+
{children}
19+
</ThemeProvider>
20+
)
21+
}
22+
23+
export default Layout

src/utils/theme.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const breakpoints = ['576px', '768px', '1000px', '1300px']
2+
3+
const namedBreakpoints = {
4+
tiny: breakpoints[0],
5+
small: breakpoints[1],
6+
medium: breakpoints[2],
7+
large: breakpoints[3],
8+
}
9+
10+
const space = [0, 4, 8, 12, 16, 24, 32, 40]
11+
12+
const fontWeights = {
13+
light: 300,
14+
normal: 400,
15+
medium: 500,
16+
semibold: 600,
17+
bold: 700,
18+
heavy: 800,
19+
}
20+
21+
const fonts = {
22+
system: `-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif`,
23+
mono: `Menlo, Monaco, OperatorMono-Book, Inconsolata, monospace`,
24+
}
25+
26+
const theme = {
27+
breakpoints,
28+
namedBreakpoints,
29+
space,
30+
fontWeights,
31+
fonts,
32+
}
33+
34+
export default theme

0 commit comments

Comments
 (0)