Skip to content

Commit

Permalink
Convert portfolio blueprint to work with ACF (#118) (#119)
Browse files Browse the repository at this point in the history
* MERL-894: Convert portfolio blueprint to work with ACF (#118)

* chore: regenerate possibleTypes.json

* chore: update Projects

* chore: update Testimonials

* chore: add atlas-blueprint-portfolio.zip

* use optional chaining and empty array fallback. props @josephfusco
  • Loading branch information
mindctrl authored Sep 7, 2023
1 parent c1a7335 commit ceca19e
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
Binary file added atlas-blueprint-portfolio.zip
Binary file not shown.
13 changes: 8 additions & 5 deletions components/Projects/Projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Projects({ projects, id, emptyText = 'No projects found.' }) {
return (
// eslint-disable-next-line react/jsx-props-no-spreading
<section {...(id && { id })}>
{projects?.map((project, i) => {
{projects.map((project, i) => {
const isFirstNewResult = i === firstNewResultIndex;

return (
Expand All @@ -43,11 +43,11 @@ function Projects({ projects, id, emptyText = 'No projects found.' }) {
<Heading level="h3">
<Link href={project?.uri ?? '#'}>
<a ref={isFirstNewResult ? firstNewResultRef : null}>
{project.title}
{project.projectFields.title}
</a>
</Link>
</Heading>
<div>{project.summary}</div>
<div>{project.projectFields.summary}</div>
</div>
</div>
</div>
Expand All @@ -62,9 +62,12 @@ Projects.fragments = {
entry: gql`
fragment ProjectsFragment on Project {
id
title
summary
uri
projectFields {
title: projectTitle
summary
contentArea
}
...FeaturedImageFragment
}
`,
Expand Down
10 changes: 6 additions & 4 deletions components/Testimonials/Testimonials.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ export default function Testimonials({ testimonials }) {
>
{testimonials.map((testimonial, index) => (
<TestimonialItem
author={testimonial?.testimonialAuthor}
author={testimonial?.testimonialFields?.testimonialAuthor}
key={index}
>
<div
className={cx('slide-content')}
dangerouslySetInnerHTML={{
__html: testimonial?.testimonialContent,
__html: testimonial?.testimonialFields?.testimonialContent,
}}
/>
</TestimonialItem>
Expand All @@ -66,8 +66,10 @@ export default function Testimonials({ testimonials }) {
Testimonials.fragments = {
entry: gql`
fragment TestimonialsFragment on Testimonial {
testimonialContent
testimonialAuthor
testimonialFields {
testimonialContent
testimonialAuthor
}
}
`,
};
9 changes: 3 additions & 6 deletions pages/projects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export default function Page() {
const { title: siteTitle } = data?.generalSettings;
const primaryMenu = data?.headerMenuItems?.nodes ?? [];
const footerMenu = data?.footerMenuItems?.nodes ?? [];
const projectList = data.projects.edges.map((el) => el.node);

const projectList = data?.projects?.nodes ?? [];
return (
<>
<SEO title={pageTitle(data?.generalSettings, 'Projects')} />
Expand Down Expand Up @@ -69,10 +68,8 @@ Page.query = gql`
$footerLocation: MenuLocationEnum
) {
projects(first: $first, after: $after) {
edges {
node {
...ProjectsFragment
}
nodes {
...ProjectsFragment
}
pageInfo {
hasNextPage
Expand Down
2 changes: 1 addition & 1 deletion possibleTypes.json

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions wp-templates/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export default function Component(props) {
const { title: siteTitle } = props?.data?.generalSettings;
const primaryMenu = props?.data?.headerMenuItems?.nodes ?? [];
const footerMenu = props?.data?.footerMenuItems?.nodes ?? [];
const { title, summary, featuredImage, contentArea } = props.data.project;
const { featuredImage } = props.data.project;
const { title, summary, contentArea } = props.data.project.projectFields;
return (
<>
<SEO
Expand Down Expand Up @@ -60,9 +61,11 @@ Component.query = gql`
$asPreview: Boolean = false
) {
project(id: $databaseId, idType: DATABASE_ID, asPreview: $asPreview) {
title: projectTitle
summary
contentArea
projectFields {
title: projectTitle
summary
contentArea
}
...FeaturedImageFragment
}
generalSettings {
Expand Down

4 comments on commit ceca19e

@headless-platform-by-wp-engine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the recent updates to your Atlas environment:

App Environment URL Build
zuni-atlas-002 ZuniAtlas002 N/A ❌ (logs)

Learn more about building on Atlas in our documentation.

@headless-platform-by-wp-engine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the recent updates to your Atlas environment:

App Environment URL Build
atlas-blueprint-portfolio main N/A ❌ (logs)

Learn more about building on Atlas in our documentation.

@headless-platform-by-wp-engine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the recent updates to your Atlas environment:

App Environment URL Build
atlas-bp-portfolio main https://ho…wered.com ✅ (logs)

Learn more about building on Atlas in our documentation.

@headless-platform-by-wp-engine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the recent updates to your Atlas environment:

App Environment URL Build
atlas-blueprint-portfoliotesttt main N/A ❌ (logs)

Learn more about building on Atlas in our documentation.

Please sign in to comment.