From 0bc2b9626b68e813fcf8e499a059b47150e5d48a Mon Sep 17 00:00:00 2001 From: Ben Demers Date: Fri, 5 Aug 2022 14:20:57 -0400 Subject: [PATCH] error proofing --- components/CoDirectorIcon.jsx | 2 +- components/about/ExecBoard.jsx | 2 +- components/gradientBanner.jsx | 32 +++++++++---------- components/projects/featureSlider.jsx | 3 +- components/projects/projectCard.jsx | 9 ++++-- components/projects/projectList.jsx | 41 +++++++++++++------------ components/projects/projectTechUsed.jsx | 40 ++++++++++++++++++------ pages/projects/[projectSlug].jsx | 7 +++-- utils/projectYear.js | 5 +++ 9 files changed, 87 insertions(+), 54 deletions(-) create mode 100644 utils/projectYear.js diff --git a/components/CoDirectorIcon.jsx b/components/CoDirectorIcon.jsx index 9c268a1..c0e3b46 100644 --- a/components/CoDirectorIcon.jsx +++ b/components/CoDirectorIcon.jsx @@ -3,7 +3,7 @@ import { Col, Card } from 'reactstrap'; const CoDirectorIcon = ({ name, title, image, memberSlug, linkedIn }) => { return ( - +
diff --git a/components/about/ExecBoard.jsx b/components/about/ExecBoard.jsx index 4039f70..11e9d4e 100644 --- a/components/about/ExecBoard.jsx +++ b/components/about/ExecBoard.jsx @@ -7,7 +7,7 @@ function ExecBoard({ execBoard }) { return (

Co-Directors

- + {execBoard .filter((x) => x.title === 'Co-Director') .map((member) => ( diff --git a/components/gradientBanner.jsx b/components/gradientBanner.jsx index b187a63..3baacc2 100644 --- a/components/gradientBanner.jsx +++ b/components/gradientBanner.jsx @@ -21,23 +21,21 @@ const GradientBanner = ({ title, subHeadline, style, arrow, children }) => ( {subHeadline && ( - - - {(props) => ( -
- {/* if it has a json key, we'll assume it's Rich Text from Contentful */} - {subHeadline.json ? ( - - ) : ( -

{subHeadline}

- )} -
- )} -
-
+ + {(props) => ( +
+ {/* if it has a json key, we'll assume it's Rich Text from Contentful */} + {subHeadline.json ? ( + + ) : ( +

{subHeadline}

+ )} +
+ )} +
)}
@@ -45,7 +44,7 @@ function FeatureSlider({ features }) { onClick={() => setCurrFeatureHeader(header)}>

{header}

- + {body && }
diff --git a/components/projects/projectCard.jsx b/components/projects/projectCard.jsx index d72d7ce..9483f6d 100644 --- a/components/projects/projectCard.jsx +++ b/components/projects/projectCard.jsx @@ -7,10 +7,15 @@ function ProjectCard({ title, thumbnail, urlSlug, description }) { return ( <> - {thumbnail.description} + {thumbnail.description}

{title}

-
+
diff --git a/components/projects/projectList.jsx b/components/projects/projectList.jsx index 2e905cd..fe7d3e9 100644 --- a/components/projects/projectList.jsx +++ b/components/projects/projectList.jsx @@ -2,31 +2,34 @@ import Section from '../section'; import { Container, Row, Col } from 'reactstrap'; import ProjectCard from './projectCard'; import groupBy from '../../utils/groupBy'; +import groupByYearSort from '../../utils/projectYear'; export default function ProjectList({ projects }) { const projectsByCompletion = groupBy(projects, 'completedIn'); return (
- {Object.entries(projectsByCompletion).map(([completedIn, projects]) => ( -
- -

{completedIn}

-
- - {projects.map(({ title, description, thumbnail, urlSlug }) => ( - - - - ))} - -
- ))} + {Object.entries(projectsByCompletion) + .sort(groupByYearSort) + .map(([completedIn, projects]) => ( +
+ +

{completedIn}

+
+ + {projects.map(({ title, description, thumbnail, urlSlug }) => ( + + + + ))} + +
+ ))}
); diff --git a/components/projects/projectTechUsed.jsx b/components/projects/projectTechUsed.jsx index 50e7e97..4b16858 100644 --- a/components/projects/projectTechUsed.jsx +++ b/components/projects/projectTechUsed.jsx @@ -158,6 +158,11 @@ const icons = { }; function ProjectTechUsed({ technologiesUsed }) { + console.log( + Object.entries(icons) + .map((entry) => entry[0]) + .join(', '), + ); return technologiesUsed?.length ? (
@@ -166,16 +171,31 @@ function ProjectTechUsed({ technologiesUsed }) { {technologiesUsed.map((tech) => ( - - {icons[tech].title} - - - {icons[tech].title} - + {icons[tech] ? ( + <> + + {icons[tech].title} + + + {icons[tech].title} + {' '} + + ) : ( + <> + + {tech} + + {tech}{' '} + + )} ))} diff --git a/pages/projects/[projectSlug].jsx b/pages/projects/[projectSlug].jsx index b0d790e..1241ede 100644 --- a/pages/projects/[projectSlug].jsx +++ b/pages/projects/[projectSlug].jsx @@ -38,7 +38,9 @@ function ProjectPage({ ) : ( - + See our code )} @@ -83,7 +85,8 @@ function ProjectPage({ /> ); })} - + {teamMembersCollection.items.size > 0 && } + See more of our projects diff --git a/utils/projectYear.js b/utils/projectYear.js new file mode 100644 index 0000000..e495324 --- /dev/null +++ b/utils/projectYear.js @@ -0,0 +1,5 @@ +export default function groupByYearSort(a, b) { + const yearA = parseInt(a[0].split(' ')[1]); + const yearB = parseInt(b[0].split(' ')[1]); + return yearB - yearA; +}