Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
394 additions
and
392 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'styled-components'; | ||
import { darken, lighten } from 'polished'; | ||
|
||
const Wrapper = styled.header` | ||
background: linear-gradient( | ||
45deg, | ||
${props => darken(0.1, props.theme.colors.primary)}, | ||
${props => lighten(0.1, props.theme.colors.primary)} | ||
); | ||
grid-column: 1 / -1; | ||
margin-left: -1rem; | ||
margin-right: -1rem; | ||
padding: 2rem 2rem 5rem 2rem; | ||
box-shadow: inset 0px -10px 30px 0px rgba(0, 0, 0, 0.1); | ||
`; | ||
|
||
const Content = styled.div` | ||
max-width: 1000px; | ||
margin: 0 auto; | ||
a { | ||
color: white; | ||
&:hover { | ||
opacity: 0.85; | ||
color: white; | ||
} | ||
} | ||
`; | ||
|
||
const Header = props => ( | ||
<Wrapper> | ||
<Content>{props.children}</Content> | ||
</Wrapper> | ||
); | ||
|
||
export default Header; | ||
|
||
Header.propTypes = { | ||
children: PropTypes.oneOfType([PropTypes.array, PropTypes.node]).isRequired, | ||
}; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styled from 'styled-components'; | ||
import { darken, lighten } from 'polished'; | ||
|
||
const Wrapper = styled.header` | ||
background: linear-gradient( | ||
45deg, | ||
${props => darken(0.1, props.theme.colors.primary)}, | ||
${props => lighten(0.1, props.theme.colors.primary)} | ||
); | ||
grid-column: 1 / -1; | ||
margin-left: -1rem; | ||
margin-right: -1rem; | ||
padding: 2rem 2rem 5rem 2rem; | ||
box-shadow: inset 0px -10px 30px 0px rgba(0, 0, 0, 0.1); | ||
`; | ||
|
||
const Content = styled.div` | ||
max-width: 1000px; | ||
margin: 0 auto; | ||
a { | ||
color: white; | ||
&:hover { | ||
opacity: 0.85; | ||
color: white; | ||
} | ||
} | ||
`; | ||
|
||
const Header = ({ children }) => ( | ||
<Wrapper> | ||
<Content>{children}</Content> | ||
</Wrapper> | ||
); | ||
|
||
export default Header; | ||
|
||
Header.propTypes = { | ||
children: PropTypes.oneOfType([PropTypes.array, PropTypes.node]).isRequired, | ||
}; |
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,78 +1,77 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Helmet from 'react-helmet'; | ||
import { Link, graphql } from 'gatsby'; | ||
import styled from 'styled-components'; | ||
import kebabCase from 'lodash/kebabCase'; | ||
import { Layout, Wrapper, Header, SectionTitle } from 'components'; | ||
import { media } from '../utils/media'; | ||
|
||
import config from '../../config/SiteConfig'; | ||
|
||
const Content = styled.div` | ||
grid-column: 2; | ||
box-shadow: 0 4px 120px rgba(0, 0, 0, 0.1); | ||
border-radius: 1rem; | ||
padding: 2rem 4rem; | ||
background-color: ${props => props.theme.colors.bg}; | ||
z-index: 9000; | ||
margin-top: -3rem; | ||
@media ${media.tablet} { | ||
padding: 3rem 3rem; | ||
} | ||
@media ${media.phone} { | ||
padding: 2rem 1.5rem; | ||
} | ||
`; | ||
|
||
const Title = styled.h3` | ||
position: relative; | ||
text-shadow: 0 12px 30px rgba(0, 0, 0, 0.15); | ||
margin-bottom: 0.75rem; | ||
`; | ||
|
||
const Category = ({ | ||
data: { | ||
allMarkdownRemark: { group }, | ||
}, | ||
}) => ( | ||
<Layout> | ||
<Wrapper> | ||
<Helmet title={`Categories | ${config.siteTitle}`} /> | ||
<Header> | ||
<Link to="/">{config.siteTitle}</Link> | ||
</Header> | ||
<Content> | ||
<SectionTitle>Categories</SectionTitle> | ||
{group.map(category => ( | ||
<Title key={category.fieldValue}> | ||
<Link to={`/categories/${kebabCase(category.fieldValue)}`}>{category.fieldValue}</Link> ({ | ||
category.totalCount | ||
}) | ||
</Title> | ||
))} | ||
</Content> | ||
</Wrapper> | ||
</Layout> | ||
); | ||
|
||
export default Category; | ||
|
||
Category.propTypes = { | ||
data: PropTypes.shape({ | ||
allMarkdownRemark: PropTypes.shape({ | ||
group: PropTypes.array.isRequired, | ||
}), | ||
}).isRequired, | ||
}; | ||
|
||
export const postQuery = graphql` | ||
query CategoriesPage { | ||
allMarkdownRemark { | ||
group(field: frontmatter___category) { | ||
fieldValue | ||
totalCount | ||
} | ||
} | ||
} | ||
`; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Helmet from 'react-helmet'; | ||
import { Link, graphql } from 'gatsby'; | ||
import styled from 'styled-components'; | ||
import kebabCase from 'lodash/kebabCase'; | ||
import { Layout, Wrapper, Header, SectionTitle } from 'components'; | ||
import { media } from '../utils/media'; | ||
|
||
import config from '../../config/SiteConfig'; | ||
|
||
const Content = styled.div` | ||
grid-column: 2; | ||
box-shadow: 0 4px 120px rgba(0, 0, 0, 0.1); | ||
border-radius: 1rem; | ||
padding: 2rem 4rem; | ||
background-color: ${props => props.theme.colors.bg}; | ||
z-index: 9000; | ||
margin-top: -3rem; | ||
@media ${media.tablet} { | ||
padding: 3rem 3rem; | ||
} | ||
@media ${media.phone} { | ||
padding: 2rem 1.5rem; | ||
} | ||
`; | ||
|
||
const Title = styled.h3` | ||
position: relative; | ||
text-shadow: 0 12px 30px rgba(0, 0, 0, 0.15); | ||
margin-bottom: 0.75rem; | ||
`; | ||
|
||
const Category = ({ | ||
data: { | ||
allMarkdownRemark: { group }, | ||
}, | ||
}) => ( | ||
<Layout> | ||
<Wrapper> | ||
<Helmet title={`Categories | ${config.siteTitle}`} /> | ||
<Header> | ||
<Link to="/">{config.siteTitle}</Link> | ||
</Header> | ||
<Content> | ||
<SectionTitle>Categories</SectionTitle> | ||
{group.map(category => ( | ||
<Title key={category.fieldValue}> | ||
<Link to={`/categories/${kebabCase(category.fieldValue)}`}>{category.fieldValue}</Link> ( | ||
{category.totalCount}) | ||
</Title> | ||
))} | ||
</Content> | ||
</Wrapper> | ||
</Layout> | ||
); | ||
|
||
export default Category; | ||
|
||
Category.propTypes = { | ||
data: PropTypes.shape({ | ||
allMarkdownRemark: PropTypes.shape({ | ||
group: PropTypes.array.isRequired, | ||
}), | ||
}).isRequired, | ||
}; | ||
|
||
export const postQuery = graphql` | ||
query CategoriesPage { | ||
allMarkdownRemark { | ||
group(field: frontmatter___category) { | ||
fieldValue | ||
totalCount | ||
} | ||
} | ||
} | ||
`; |
Oops, something went wrong.