Skip to content

Commit 49db52c

Browse files
committed
Get profile and projects from contentful
1 parent dcdeba9 commit 49db52c

File tree

6 files changed

+321
-61
lines changed

6 files changed

+321
-61
lines changed

gatsby-config.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ module.exports = {
1010
description: `Software engineer by trade. Hobbyist programmer with wide
1111
experience in programming languages and frameworks. I graduated in 2020
1212
from Drexel University with a Bachelor's in Computer Engineering and I'm
13-
currently working as #jobTitle for #company. I'm also a CompTIA A+
14-
certified computer technician. I'm most experienced in Python, JavaScript,
15-
and C++, although I'm continuously expanding my skillset and learning new
16-
things.`,
13+
currently working as #jobTitle for #company. I'm most experienced in
14+
Python and JavaScript, although I'm continuously expanding my skillset
15+
and learning new things.`,
1716
contact: {
1817
email: 'akanshul97@gmail.com',
1918
linkedin: 'https://www.linkedin.com/in/anshul-kharbanda-03433712b/',
@@ -64,6 +63,13 @@ module.exports = {
6463
'gatsby-plugin-react-helmet',
6564
'gatsby-plugin-scroll-reveal',
6665
'gatsby-transformer-yaml',
66+
{
67+
resolve: 'gatsby-source-contentful',
68+
options: {
69+
spaceId: 'ki8v6ao5nutn',
70+
accessToken: process.env.CONTENTFUL_ACCESS_TOKEN
71+
}
72+
},
6773
{
6874
resolve: 'gatsby-source-filesystem',
6975
options: {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"gatsby-plugin-scroll-reveal": "0.0.7",
3333
"gatsby-plugin-sharp": "^5.12.0",
3434
"gatsby-plugin-styled-components": "^6.12.0",
35+
"gatsby-source-contentful": "^8.13.2",
3536
"gatsby-source-filesystem": "^5.12.0",
3637
"gatsby-transformer-json": "^5.12.0",
3738
"gatsby-transformer-sharp": "^5.12.0",

src/sections/about.js

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,16 @@ export default function About() {
8888
}
8989
}
9090
}
91-
profile: file(relativePath: { eq: "images/profile.jpg" }) {
92-
childImageSharp {
93-
gatsbyImageData(
94-
layout: FIXED
95-
width: 300
96-
aspectRatio: 1
97-
transformOptions: {
98-
duotone: { highlight: "#0088ff", shadow: "#000000" }
99-
}
100-
)
101-
}
91+
profile: contentfulAsset(title: { glob: "Profile Photo" }) {
92+
gatsbyImageData(
93+
layout: FIXED
94+
width: 300
95+
aspectRatio: 1
96+
)
10297
}
103-
workYaml(timeline: { current: { eq: true } }) {
98+
currentJob: contentfulWorkExperience(currentlyWorking: {eq: true}) {
10499
jobTitle
105-
company
100+
companyName
106101
}
107102
}
108103
`)
@@ -111,6 +106,7 @@ export default function About() {
111106
<Section id="about">
112107
<h1
113108
data-sal="slide-up"
109+
data-sal-delay="300"
114110
data-sal-duration="500"
115111
data-sal-easing="ease"
116112
>
@@ -133,13 +129,8 @@ export default function About() {
133129
data-sal-easing="ease"
134130
>
135131
{about.site.siteMetadata.description
136-
.replace(
137-
'#jobTitle',
138-
`${article(about.workYaml.jobTitle)} ${
139-
about.workYaml.jobTitle
140-
}`
141-
)
142-
.replace('#company', about.workYaml.company)}
132+
.replace('#jobTitle', `${article(about.currentJob.jobTitle)} ${about.currentJob.jobTitle}`)
133+
.replace('#company', about.currentJob.companyName)}
143134
</Blurb>
144135
<StyledLink
145136
href={`https://github.com/${about.site.siteMetadata.contact.github}`}

src/sections/hero.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import { graphql, useStaticQuery } from 'gatsby'
21
import React, { useState, useEffect, useMemo } from 'react'
32
import styled from 'styled-components'
4-
import { GatsbyImage, getImage, withArtDirection } from 'gatsby-plugin-image'
53
import Particles, { initParticlesEngine } from '@tsparticles/react'
64
import { loadSlim } from '@tsparticles/slim'
75
import { starbound } from '../styling'

src/sections/projects.js

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,20 @@ import Section from '../components/section'
1010

1111
export default function Projects() {
1212
// Query
13-
const {
14-
allProjectsYaml: { nodes: projects }
15-
} = useStaticQuery(graphql`
13+
const projects = useStaticQuery(graphql`
1614
query ProjectsQuery {
17-
allProjectsYaml {
15+
allContentfulProject {
1816
nodes {
1917
id
2018
title
21-
image {
22-
childImageSharp {
23-
gatsbyImageData(
24-
layout: CONSTRAINED
25-
transformOptions: {
26-
duotone: {
27-
highlight: "#0088ff"
28-
shadow: "#000000"
29-
}
30-
}
31-
)
32-
}
19+
screenshot {
20+
gatsbyImageData(layout: CONSTRAINED)
21+
}
22+
description {
23+
description
3324
}
34-
description
35-
main
3625
github
26+
link
3727
}
3828
}
3929
}
@@ -50,40 +40,36 @@ export default function Projects() {
5040
Stuff I've Made
5141
</h1>
5242
<Grid>
53-
{projects.map(
54-
({ id, title, image, description, github, main }) => (
43+
{projects.allContentfulProject.nodes.map(
44+
({ id, title, screenshot, description, github, link }) => (
5545
<Panel
5646
key={id}
57-
large={image !== undefined && image !== null}
47+
large={screenshot !== undefined && screenshot !== null}
5848
data-sal="slide-up"
5949
data-sal-duration="500"
6050
data-sal-easing="ease"
6151
>
62-
{(image && (
52+
{(screenshot && (
6353
<Panel.ImageTitle
6454
title={title}
65-
imageData={getImage(image)}
55+
imageData={getImage(screenshot)}
6656
/>
6757
)) || <Panel.Title title={title} />}
6858
<Panel.Body>
69-
<p>{description}</p>
59+
<p>{description.description}</p>
7060
</Panel.Body>
7161
<Panel.Footer>
7262
<IconLink.Group>
73-
{main && (
63+
{link && (
7464
<IconLink
7565
icon={faExternalLinkAlt}
76-
href={main}
66+
href={link}
7767
/>
7868
)}
7969
{github && (
8070
<IconLink
8171
icon={faGithub}
82-
href={`https://github.com/${
83-
github.includes('/')
84-
? github
85-
: 'andydevs/' + github
86-
}`}
72+
href={github}
8773
/>
8874
)}
8975
</IconLink.Group>

0 commit comments

Comments
 (0)