Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[part-16] Added contact page and a custom template for the page
- Updated "Navigation" with contact page link
- Loading branch information
Showing
3 changed files
with
100 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
contentKey: page | ||
title: Contact | ||
description: Ask me anything! | ||
--- | ||
The choice was red, green, or blue. It didn't seem like an important choice when he was making it, but it was a choice nonetheless. Had he known the consequences at that time, he would likely have considered the choice a bit longer. In the end, he didn't and ended up choosing blue. |
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 { graphql } from 'gatsby'; | ||
import React from 'react' | ||
import Layout from '../components/Layout.js'; | ||
import PageHeader from '../components/PageHeader.js'; | ||
|
||
const ContactTemplate = (props) => { | ||
|
||
console.log(props); | ||
|
||
return ( | ||
<Layout> | ||
<PageHeader frontmatter={props.data.markdownRemark.frontmatter} /> | ||
<div | ||
dangerouslySetInnerHTML={{ | ||
__html: ` | ||
${props.data.markdownRemark.html} | ||
<ul> | ||
<li> | ||
<a href="mailto:${props.data.settings.frontmatter.settings.email}" rel="noreferrer nofollow"> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="${props.data.settings.frontmatter.settings.facebook}" rel="noreferrer nofollow"> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="${props.data.settings.frontmatter.settings.twitter}" rel="noreferrer nofollow"> | ||
</a> | ||
</li> | ||
<li> | ||
<a href="${props.data.settings.frontmatter.settings.youtube}" rel="noreferrer nofollow"> | ||
YouTube | ||
</a> | ||
</li> | ||
</ul> | ||
` | ||
}} | ||
className=' | ||
container | ||
py-8 px-4 | ||
md:px-0 | ||
prose | ||
prose-p:text-stone-900 | ||
prose-img:rounded-lg | ||
'> | ||
</div> | ||
</Layout> | ||
) | ||
} | ||
|
||
export const query = graphql` | ||
query($pageId: String = "") { | ||
markdownRemark(id: { eq: $pageId }) { | ||
id | ||
fields { | ||
slug | ||
} | ||
frontmatter { | ||
title | ||
description | ||
} | ||
html | ||
} | ||
settings: markdownRemark(frontmatter: {contentKey: {eq: "setting"}}) { | ||
frontmatter { | ||
title | ||
description | ||
settings { | ||
siteTitle | ||
youtube | ||
} | ||
} | ||
} | ||
} | ||
` | ||
|
||
export default ContactTemplate |