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
24 changes: 21 additions & 3 deletions src/components/Footer/Subscription/subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,38 @@ import "./subscription.scss"
export default function Subscription() {
const data = useFooter()
const dataSubscription = data?.allStrapiLayout?.nodes[0]?.footer?.subscription
const subscriptionUrl = dataSubscription?.url
const subscriptionLanding = dataSubscription?.landing_page?.slug

const isExternalLink = subscriptionUrl?.startsWith('http')

return (
<div className="ContactData__Item contactData-container">
<h6 className="titleSubscription">{dataSubscription?.title}</h6>
<div>
<div className="ContactData__Form d-flex flex-md-column justify-content-between">
<button className="col-5">
<Link to="/recibe-nuestra-newsletter" >¡Aquí!</Link>
{
isExternalLink ? (
<a href={subscriptionUrl} target="_blank" rel="noopener noreferrer">¡Aquí!</a>
) : (
<Link to={subscriptionLanding}>¡Aquí!</Link>
)
}
{/* <Link to="/recibe-nuestra-newsletter" >¡Aquí!</Link> */}
</button>
</div>
</div>
<button className="col-5 contactData-mobile_button">
<Link to="/recibe-nuestra-newsletter" >{dataSubscription?.title}</Link>
{
isExternalLink ? (
<a href={subscriptionUrl} target="_blank" rel="noopener noreferrer">{dataSubscription?.title}</a>
) : (
<Link to={subscriptionLanding}>{dataSubscription?.title}</Link>
)
}
{/* <Link to="/recibe-nuestra-newsletter" >{dataSubscription?.title}</Link> */}
</button>
</div>
)
}
}
7 changes: 5 additions & 2 deletions src/hooks/useFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ const useFooter = () => {
}
subscription {
title
url
landing_page {
slug
}
}
}
}
Expand All @@ -82,5 +86,4 @@ const useFooter = () => {
`)
}

export default useFooter

export default useFooter
27 changes: 27 additions & 0 deletions src/schema/layoutSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,34 @@ type StrapiLayoutNavbarNavButtonLanding_page {
type StrapiLayoutFooterSubscription {
id: Int
title: String
url: String
landing_page: StrapiLayoutFooterSubscriptionLanding
}

type StrapiLayoutFooterSubscriptionLanding {
id: Int
name: String
slug: String
published_at(
formatString: String
fromNow: Boolean
difference: String
locale: String
): Date
created_at(
formatString: String
fromNow: Boolean
difference: String
locale: String
): Date
updated_at(
formatString: String
fromNow: Boolean
difference: String
locale: String
): Date
}


type StrapiLayoutFooterNavegation {
id: Int
Expand Down
26 changes: 26 additions & 0 deletions src/schema/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,32 @@ type StrapiLayoutNavbarLogo {
type StrapiLayoutFooterSubscription {
id: Int
title: String
url: String
landing_page: StrapiLayoutFooterSubscriptionLanding
}

type StrapiLayoutFooterSubscriptionLanding {
id: Int
name: String
slug: String
published_at(
formatString: String
fromNow: Boolean
difference: String
locale: String
): Date
created_at(
formatString: String
fromNow: Boolean
difference: String
locale: String
): Date
updated_at(
formatString: String
fromNow: Boolean
difference: String
locale: String
): Date
}

type StrapiLayoutFooterNavegation {
Expand Down