Skip to content

Commit

Permalink
Merge pull request #137 from adrianponce89/fixes/hotlist
Browse files Browse the repository at this point in the history
fixing portfolio active property
  • Loading branch information
agusruidiazgd authored Feb 22, 2022
2 parents 8ef36d2 + 84e0601 commit 2372b96
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
23 changes: 13 additions & 10 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,19 @@ exports.createPages = ({ graphql, actions }) => {
},
});
});
projects.forEach((project) => {
createPage({
path: `/portfolio/${project.node.category}/${project.node.contentful_id}/`,
component: ProjectTemplate,
context: {
servicesInfo: services,
projectType: project.node.type,
project: project.node,
},
});
projects && projects.forEach((project) => {
if(project.active){
createPage({
path: `/portfolio/${project.node.category}/${project.node.contentful_id}/`,
component: ProjectTemplate,
context: {
servicesInfo: services,
projectType: project.node.type,
project: project.node,
},
});
}

});
}),
);
Expand Down
4 changes: 3 additions & 1 deletion src/components/Home/Services.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ const Services = ({ services, projects}) => {
.slice(1, 5)
.map((service, index) => {
let viewPage = projects.some(
(project) => project.category === service.node.category,
(project) =>
project.category === service.node.category &&
project.active,
);
return (
<ServiceItem
Expand Down
10 changes: 8 additions & 2 deletions src/components/Portfolio/Detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ const DetailPortfolio = ({ portfolios, projectsContent }) => {
<Grid container xs={12} className={classes.gridContainer}>
{portfolios.map((node) => {
let viewPage = projectsContent.some(
(project) => project.category === node.category,
);
(project) =>{
if(project.active){
return project.category === node.category
}else{
return false
}
}
);

return (
<Link
Expand Down
4 changes: 3 additions & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ export default (props) => {
'data.contentfulLandingDescription',
);
const servicesHome = get(props, 'data.allContentfulService');
const portfolio = get(props, 'data.allContentfulPortfolio.nodes');
const portfolio = get(props, 'data.allContentfulPortfolio.nodes');
const plans = get(props, 'data.allContentfulPlan.edges');
const aboutUs = get(props, 'data.allContentfulAboutUs.nodes');
const clients = get(props, 'data.allContentfulHomeClients');

console.log('portfolioportfolio', portfolio);

const handleScroll = () => {
if (window.scrollY >= 300 && !isActive && firstView) {
setIsActive(true);
Expand Down

0 comments on commit 2372b96

Please sign in to comment.