-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added experience and education pages
- Loading branch information
Marvin Heilemann
committed
Mar 1, 2020
1 parent
7c4a148
commit 72487c9
Showing
15 changed files
with
642 additions
and
5 deletions.
There are no files selected for viewing
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react' | ||
import { Link as NativeLink } from 'gatsby' | ||
|
||
import Time from '../Time' | ||
|
||
const Item = ({ title, description, started, ended, link }) => ( | ||
<div className="item"> | ||
<div className="timespan"> | ||
<Time date={started} /> – <Time date={ended} /> | ||
</div> | ||
<div className="title"> | ||
<NativeLink to={link}>{title}</NativeLink> | ||
</div> | ||
<div className="desc">{description}</div> | ||
</div> | ||
) | ||
|
||
export default Item |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react' | ||
|
||
import Item from './Item' | ||
import Icon from '../Icon' | ||
|
||
const Section = ({ name, icon, data }) => { | ||
return ( | ||
<section> | ||
<header> | ||
<Icon name={icon} /> | ||
<h2 className="title">{name}</h2> | ||
</header> | ||
<div className="items"> | ||
{data.map((props, index) => ( | ||
<Item key={index} {...props} /> | ||
))} | ||
</div> | ||
</section> | ||
) | ||
} | ||
|
||
export default Section |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
|
||
import Section from './Section' | ||
|
||
const Timeline = ({ data }) => { | ||
return ( | ||
<div className="container container--small"> | ||
<div id="timeline"> | ||
{data.map((props, index) => ( | ||
<Section key={index} {...props} /> | ||
))} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Timeline |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import React from 'react' | ||
import { graphql } from 'gatsby' | ||
|
||
import { HistoryConsumer } from '../../provider/history' | ||
import Head from '../../components/Head' | ||
import Timeline from '../../components/timeline/Timeline' | ||
|
||
class Page extends React.Component { | ||
state = { | ||
pageName: 'Education', | ||
} | ||
|
||
componentDidMount() { | ||
const { breadcrumb } = this.props.pageContext | ||
|
||
this.props.history.update({ | ||
location: breadcrumb.location, | ||
crumbLabel: this.state.pageName, | ||
crumbs: breadcrumb.crumbs, | ||
}) | ||
} | ||
|
||
render() { | ||
const { | ||
allMdx: { edges }, | ||
} = this.props.data | ||
|
||
const timelineSection = edges.map(({ node: { frontmatter, fields, excerpt } }) => ({ | ||
title: frontmatter.title, | ||
description: excerpt, | ||
started: frontmatter.started, | ||
ended: frontmatter.ended, | ||
link: fields.slug, | ||
})) | ||
const timelineData = [ | ||
{ | ||
name: 'Education', | ||
icon: 'book', | ||
data: timelineSection, | ||
}, | ||
] | ||
|
||
return ( | ||
<> | ||
<Head pageName={this.state.pageName} bodyClasses="home" /> | ||
|
||
<h1 className="headline">{this.state.pageName}</h1> | ||
|
||
<Timeline data={timelineData} /> | ||
</> | ||
) | ||
} | ||
} | ||
|
||
export default React.forwardRef((props, ref) => ( | ||
<HistoryConsumer> | ||
{(history) => <Page {...props} ref={ref} history={history} />} | ||
</HistoryConsumer> | ||
)) | ||
|
||
export const query = graphql` | ||
query EducationQuery { | ||
allMdx( | ||
filter: { fields: { source: { eq: "education" } } } | ||
sort: { fields: [frontmatter___ended, frontmatter___started], order: DESC } | ||
) { | ||
edges { | ||
node { | ||
frontmatter { | ||
title | ||
qualifications | ||
started | ||
ended | ||
} | ||
fields { | ||
slug | ||
} | ||
excerpt | ||
} | ||
} | ||
} | ||
} | ||
` |
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import React from 'react' | ||
import { graphql } from 'gatsby' | ||
|
||
import { HistoryConsumer } from '../../provider/history' | ||
import Head from '../../components/Head' | ||
import Timeline from '../../components/timeline/Timeline' | ||
|
||
class Page extends React.Component { | ||
state = { | ||
pageName: 'Experience', | ||
} | ||
|
||
componentDidMount() { | ||
const { breadcrumb } = this.props.pageContext | ||
|
||
this.props.history.update({ | ||
location: breadcrumb.location, | ||
crumbLabel: this.state.pageName, | ||
crumbs: breadcrumb.crumbs, | ||
}) | ||
} | ||
|
||
render() { | ||
const { | ||
allMdx: { edges }, | ||
} = this.props.data | ||
|
||
const timelineSection = edges.map(({ node: { frontmatter, fields, excerpt } }) => ({ | ||
title: frontmatter.title, | ||
description: excerpt, | ||
started: frontmatter.started, | ||
ended: frontmatter.ended, | ||
link: fields.slug, | ||
})) | ||
const timelineData = [ | ||
{ | ||
name: 'Experience', | ||
icon: 'briefcase', | ||
data: timelineSection, | ||
}, | ||
] | ||
|
||
return ( | ||
<> | ||
<Head pageName={this.state.pageName} bodyClasses="home" /> | ||
|
||
<h1 className="headline">{this.state.pageName}</h1> | ||
|
||
<Timeline data={timelineData} /> | ||
</> | ||
) | ||
} | ||
} | ||
|
||
export default React.forwardRef((props, ref) => ( | ||
<HistoryConsumer> | ||
{(history) => <Page {...props} ref={ref} history={history} />} | ||
</HistoryConsumer> | ||
)) | ||
|
||
export const query = graphql` | ||
query ExperienceQuery { | ||
allMdx( | ||
filter: { fields: { source: { eq: "experience" } } } | ||
sort: { fields: [frontmatter___ended, frontmatter___started], order: DESC } | ||
) { | ||
edges { | ||
node { | ||
frontmatter { | ||
title | ||
position | ||
started | ||
ended | ||
} | ||
fields { | ||
slug | ||
} | ||
excerpt | ||
} | ||
} | ||
} | ||
} | ||
` |
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
Oops, something went wrong.