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
import styled from 'styled-components'; | |
import { border, color, compose, flexbox, layout, position, shadow, space, typography } from 'styled-system'; | |
export const Div = styled('div')( | |
compose(border, space, layout, typography, color, position, shadow, flexbox) | |
); | |
export const Flex = styled(Div)` | |
display: flex; |
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
export const theme = { | |
breakpoints: [32, 48, 64], | |
space: [0, 4, 8, 16, 24, 32, 48, 64, 128, 256, 512], | |
fontSizes: [12, 14, 16, 18, 20, 24, 36, 48, 80, 96], | |
fontWeights: [100, 200, 300, 400, 500, 600, 700, 800, 900], | |
lineHeights: { | |
normal: 1, | |
title: 1.25, | |
paragraph: 1.5 | |
}, |
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
export const pageQuery = graphql` | |
query BlogPostBySlug($slug: String!) { | |
site { | |
siteMetadata { | |
title | |
} | |
} | |
markdownRemark(fields: { slug: { eq: $slug } }) { | |
id | |
excerpt(pruneLength: 160) |
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
import RehypeReact from "rehype-react" | |
const renderAst = new RehypeReact({ | |
createElement: React.createElement, | |
components: { | |
h1: Title, | |
p: Paragraph, | |
}, | |
}).Compiler; |
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
import styled from "styled-components"; | |
export const Title = styled.h1` | |
font-size: 3em; | |
text-align: center; | |
color: yellowgreen; | |
`; | |
export const Paragraph = styled.p` | |
font-size: 1em; |
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
{ | |
resolve: `gatsby-transformer-remark`, | |
options: { | |
plugins: [ | |
{ | |
resolve: `gatsby-remark-classes`, | |
options: { | |
classMap: { | |
"heading[depth=1]": "text-2xl", | |
"heading[depth=2]": "text-xl", |
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
import React from 'react'; | |
import styled from 'styled-components'; | |
const StyledInput = styled.input` | |
color: ${props => props.disabled ? `${props.theme.colors.gray}` : `${props.theme.colors.darkgray}`}; | |
font-size: ${props => `${props.theme.fontSizes[2]}px`}; | |
border: 1px solid; | |
border-color: ${props => props.theme.colors[props.borderColor] || props.theme.colors.lightgray}; | |
background: ${props => props.theme.colors[props.bg] || props.theme.colors.white}; | |
border-radius: ${props => `${props.theme.radii[2]}`}; |
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
export const theme = { | |
breakpoints: [32, 48, 64], | |
space: [0, 4, 8, 16, 24, 32, 48, 64, 128, 256, 512], | |
fontSizes: [12, 14, 16, 18, 20, 24, 36, 48, 80, 96], | |
fontWeights: [100, 200, 300, 400, 500, 600, 700, 800, 900], | |
lineHeights: { | |
normal: 1, | |
title: 1.25, | |
paragraph: 1.5 | |
}, |
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
import React, { useState } from 'react'; | |
const useName = () => { | |
const [name, setValue] = useState(''); | |
const setName = name => { | |
setValue(name); | |
}; | |
return { name, setName }; |
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
import React from 'react'; | |
import { useName } from '../logics/useName'; | |
const Create = () => { | |
const { name, setName } = useName(); | |
const onChange = e => { | |
setName(e.target.value); | |
}; |