Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
add basic home page
- Loading branch information
1 parent
83d7d07
commit ffdcc67
Showing
4 changed files
with
71 additions
and
4 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
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,5 +1,66 @@ | ||
| import React from "react"; | ||
| import { graphql } from "gatsby"; | ||
| import Img from "gatsby-image"; | ||
| import { Box } from "rebass"; | ||
| import styled from "styled-components"; | ||
| import AniLink from "gatsby-plugin-transition-link/AniLink"; | ||
|
|
||
| const Home = () => <div>Hello world</div>; | ||
| import { Description } from "../components/project-header"; | ||
| import Layout from "../components/layout"; | ||
|
|
||
| const Grid = styled(Box)` | ||
| display: grid; | ||
| grid-template-columns: repeat(3, 1fr); | ||
| grid-gap: ${props => props.theme.space[3]}px; | ||
| `; | ||
|
|
||
| const ProjectGridItem = ({ project }) => { | ||
| return ( | ||
| <AniLink | ||
| style={{ textDecoration: "none" }} | ||
| fade | ||
| to={`/projects/${project.slug}`} | ||
| duration={0.2} | ||
| > | ||
| <Box> | ||
| <Img fluid={project.featuredPhoto.fluid} /> | ||
| <Box mt={3}> | ||
| <Description>{project.title}</Description> | ||
| </Box> | ||
| </Box> | ||
| </AniLink> | ||
| ); | ||
| }; | ||
|
|
||
| const Home = ({ data }) => { | ||
| const projects = data.projects.edges; | ||
| return ( | ||
| <Layout> | ||
| <Grid> | ||
| {projects.map(project => ( | ||
| <ProjectGridItem key={project.node.title} project={project.node} /> | ||
| ))} | ||
| </Grid> | ||
| </Layout> | ||
| ); | ||
| }; | ||
|
|
||
| export const query = graphql` | ||
| { | ||
| projects: allDatoCmsProject { | ||
| edges { | ||
| node { | ||
| slug | ||
| title | ||
| featuredPhoto { | ||
| fluid { | ||
| ...GatsbyDatoCmsFluid | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| `; | ||
|
|
||
| export default Home; |
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