Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/components/BlogPage/BlogArticle/BlogArticle.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ import "./BlogArticle.scss"
const BlogArticle = ({ title, summary, image, slug, text }) => {
return (
<div className="article__container">
<GatsbyImage
image={getImage(image?.localFile)}
alt={title}
className="article__image"
/>
{image?.localFile ? (
<GatsbyImage
image={getImage(image?.localFile)}
alt={title}
className="article__image"
/>
) : (
<img src={image?.url} alt={title} className="article__image" />
)}
<div className="article__description">
<h6>{`${title} ...`}</h6>
<div>
Expand Down
3 changes: 1 addition & 2 deletions src/components/BlogPage/BlogArticle/BlogArticle.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import "../../../styles/global.scss";
.article {
color: $primary;
&__container {
display: flex;
justify-content: center;
Expand All @@ -21,7 +22,6 @@
width: 100%;
height: 150px;
padding: 0 15px;
color: $black;
h1,
h2,
h3,
Expand All @@ -32,7 +32,6 @@
font-size: 15px !important;
margin-bottom: 15px;
line-height: 1rem;
color: $black;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
Expand Down
28 changes: 28 additions & 0 deletions src/components/FeaturedBlogs/FeaturedBlogs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from "react"

import "./featuredBlogs.scss"
import BlogArticle from "../BlogPage/BlogArticle/BlogArticle"

const FeaturedBlogs = ({ data }) => {
return (
<div className="contaner featured" id={data.strapi_component + "-" + data.id}>
<h2>{data.title}</h2>
<h6 className="px-5">{data.subtitle}</h6>

<div className="featured-blogs">
{data.articles.slice(0, 3).map((item, idx) => (
<BlogArticle
key={idx}
image={item.image}
title={item.title}
summary={item.summary}
slug={"/blog/" + item.slug}
text="Ver más"
/>
))}
</div>
</div>
)
}

export default FeaturedBlogs
27 changes: 27 additions & 0 deletions src/components/FeaturedBlogs/featuredBlogs.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@import "../../styles/global.scss";

.featured {
color: $primary;
h2 {
flex-grow: 1;
text-align: center;
font-weight: 700;
}
h6 {
text-align: center;
line-height: 30px;
font-weight: 400;
}

&-blogs {
display: flex;
flex-direction: row;
justify-content: center;
& > * {
flex-basis: 33%;
}
@media screen and (max-width: $breakpoint-lg) {
flex-direction: column;
}
}
}
6 changes: 3 additions & 3 deletions src/components/NavBar/AnimatedNavBar/AnimatedNavbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const getComponentTitle = component => {
"components.cases-section": () => component.title,
"home.quote": () => component.title,
"home.video-background": () => component.title,
"components.featured-blogs": () => component.title,
"home.dual-section": () =>
component.dualSectionPart.map(section => section.title).join(" - "),
}
return (
(titleReference[component.strapi_component] &&
titleReference[component.strapi_component]()) ||
"Titulo no definido"
titleReference[component.strapi_component] &&
titleReference[component.strapi_component]()
)
}

Expand Down
5 changes: 3 additions & 2 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import DualSection from "./DualSection/DualSection"
import AnimatedTransitionContinous from "./animatedTransitionContinous/AnimatedTransitionContinous"
import BannerTop from "./Banners/BannerTop"
import BannerHead from "./BannerHead/BannerHead";

import FeaturedBlogs from './FeaturedBlogs/FeaturedBlogs'

export {
Cards,
Expand All @@ -34,5 +34,6 @@ export {
DualSection,
AnimatedTransitionContinous,
BannerTop,
BannerHead
BannerHead,
FeaturedBlogs
}
12 changes: 9 additions & 3 deletions src/templates/LandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import {
AnimatedTransitionContinous,
DualSection,
OneSection,
Quote
Quote,
FeaturedBlogs
} from "../components"

import VideoBackground from "../components/videoBackground/VideoBackground"


const LandingPage = ({ data, location }) => {
const pageData = data?.allStrapiLandingPage?.nodes[0]
const content = pageData.body.map((component, idx) => {
Expand Down Expand Up @@ -88,11 +88,16 @@ const LandingPage = ({ data, location }) => {
<AnimatedTransitionContinous data={component} />
) : null

const videoBackground =
const videoBackground =
component.strapi_component === "home.video-background" ? (
<VideoBackground data={component} />
) : null

const featuredBlogs =
component.strapi_component === "components.featured-blogs" ? (
<FeaturedBlogs data={component} />
) : null

return (
<div key={idx}>
<>
Expand All @@ -109,6 +114,7 @@ const LandingPage = ({ data, location }) => {
{quote}
{dualSection}
{animatedTransition}
{featuredBlogs}
</>
</div>
)
Expand Down