Skip to content

Commit 30ca388

Browse files
committed
Add option for black text for project title
1 parent e466169 commit 30ca388

File tree

5 files changed

+3163
-2940
lines changed

5 files changed

+3163
-2940
lines changed

gatsby-node.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
const axios = require('axios')
2+
const sharp = require('sharp')
3+
14
exports.createSchemaCustomization = ({ actions }) => {
25
const { createTypes } = actions
36
const typeDefs = `
@@ -11,4 +14,4 @@ exports.createSchemaCustomization = ({ actions }) => {
1114
}
1215
`
1316
createTypes(typeDefs)
14-
}
17+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@tsparticles/engine": "^3.4.0",
2424
"@tsparticles/react": "^3.0.0",
2525
"@tsparticles/slim": "^3.4.0",
26+
"axios": "^1.8.4",
2627
"babel-plugin-styled-components": "^2.1.4",
2728
"date-fns": "^3.6.0",
2829
"gatsby": "^5.12.3",
@@ -44,6 +45,7 @@
4445
"react-dom": "^18.2.0",
4546
"react-helmet": "^6.1.0",
4647
"react-remark": "^2.1.0",
48+
"sharp": "^0.34.1",
4749
"styled-components": "^6.0.7",
4850
"tsparticles-slim": "^2.12.0"
4951
},

src/components/panel.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ const ImageTitle = styled.h3`
4949
margin: 16pt;
5050
font-weight: 500;
5151
font-size: 28pt;
52+
53+
color: ${props => props.black ? `var(--black)` : `var(--white)`}
5254
`
5355

5456
const TitleHeader = styled.div`
@@ -70,11 +72,11 @@ Panel.Title = ({ title }) => (
7072
</TitleHeader>
7173
)
7274

73-
Panel.ImageTitle = ({ title, imageData }) => (
75+
Panel.ImageTitle = ({ title, black=false, imageData }) => (
7476
<ImageTitleHeader>
7577
<ImageTitleContainer>
7678
<GatsbyImage image={imageData} />
77-
<ImageTitle>{title}</ImageTitle>
79+
<ImageTitle black={black}>{title}</ImageTitle>
7880
</ImageTitleContainer>
7981
</ImageTitleHeader>
8082
)

src/sections/projects.js

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default function Projects() {
1919
screenshot {
2020
gatsbyImageData(layout: CONSTRAINED)
2121
}
22+
screenshotBlackTitle
2223
description {
2324
description
2425
}
@@ -41,41 +42,44 @@ export default function Projects() {
4142
</h1>
4243
<Grid>
4344
{projects.allContentfulProject.nodes.map(
44-
({ id, title, screenshot, description, github, link }) => (
45-
<Panel
46-
key={id}
47-
large={screenshot !== undefined && screenshot !== null}
48-
data-sal="slide-up"
49-
data-sal-duration="500"
50-
data-sal-easing="ease"
51-
>
52-
{(screenshot && (
53-
<Panel.ImageTitle
54-
title={title}
55-
imageData={getImage(screenshot)}
56-
/>
57-
)) || <Panel.Title title={title} />}
58-
<Panel.Body>
59-
<p>{description.description}</p>
60-
</Panel.Body>
61-
<Panel.Footer>
62-
<IconLink.Group>
63-
{link && (
64-
<IconLink
65-
icon={faExternalLinkAlt}
66-
href={link}
67-
/>
68-
)}
69-
{github && (
70-
<IconLink
71-
icon={faGithub}
72-
href={github}
73-
/>
74-
)}
75-
</IconLink.Group>
76-
</Panel.Footer>
77-
</Panel>
78-
)
45+
({ id, title, screenshot, screenshotBlackTitle, description, github, link }) => {
46+
return (
47+
<Panel
48+
key={id}
49+
large={screenshot !== undefined && screenshot !== null}
50+
data-sal="slide-up"
51+
data-sal-duration="500"
52+
data-sal-easing="ease"
53+
>
54+
{(screenshot && (
55+
<Panel.ImageTitle
56+
title={title}
57+
imageData={getImage(screenshot)}
58+
black={screenshotBlackTitle}
59+
/>
60+
)) || <Panel.Title title={title} />}
61+
<Panel.Body>
62+
<p>{description.description}</p>
63+
</Panel.Body>
64+
<Panel.Footer>
65+
<IconLink.Group>
66+
{link && (
67+
<IconLink
68+
icon={faExternalLinkAlt}
69+
href={link}
70+
/>
71+
)}
72+
{github && (
73+
<IconLink
74+
icon={faGithub}
75+
href={github}
76+
/>
77+
)}
78+
</IconLink.Group>
79+
</Panel.Footer>
80+
</Panel>
81+
)
82+
}
7983
)}
8084
</Grid>
8185
</Section>

0 commit comments

Comments
 (0)