-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from PyConColombia/issue-115
#115 Crear vista base para patrocinadores
- Loading branch information
Showing
7 changed files
with
276 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Image from 'next/image'; | ||
import Container from 'react-bootstrap/Container'; | ||
import Row from 'react-bootstrap/Row'; | ||
import Col from 'react-bootstrap/Col'; | ||
import Button from 'react-bootstrap/Button'; | ||
|
||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { faCircle, faGlobe } from '@fortawesome/free-solid-svg-icons'; | ||
import { | ||
faXTwitter, | ||
faLinkedinIn, | ||
faGithubAlt, | ||
faFacebook, | ||
faGitlab | ||
} from '@fortawesome/free-brands-svg-icons'; | ||
|
||
const Sponsors = ({ level, sponsor, lang }) => { | ||
const labels = { | ||
diamond: 'Diamante', | ||
platinum: 'Platinum', | ||
gold: 'Gold', | ||
silver_plus: 'Silver+', | ||
silver: 'Silver', | ||
bronze: 'Bronze' | ||
}; | ||
|
||
return ( | ||
<section id="keynote" className="sponsor"> | ||
<div className="keynote-bg sponsor-bg"> | ||
<Container> | ||
<Row className="justify-content-center"> | ||
<Col xs={12}> | ||
<div className="image-wrapper"> | ||
<Image | ||
className={`img-sponsor`} | ||
src={`/images/sponsor/${sponsor.image}`} | ||
alt={sponsor.name} | ||
width={300} | ||
height={300} | ||
/> | ||
<div className="badge-wrapper"> | ||
<span className={`badge ${level}`}>{labels[level]}</span> | ||
</div> | ||
</div> | ||
</Col> | ||
</Row> | ||
<Row className="justify-content-center"> | ||
<Col xs={12} md={3}> | ||
<div className={`social-icons`}> | ||
{sponsor.facebook && ( | ||
<a | ||
href={`https://www.facebook.com/${sponsor.facebook}`} | ||
target="_blank" | ||
rel="noreferrer"> | ||
<div className="fa-stack"> | ||
<FontAwesomeIcon className="fa-stack-2x" icon={faCircle} color="white" /> | ||
<FontAwesomeIcon className="social-icon fa-stack-1x" icon={faFacebook} /> | ||
</div> | ||
</a> | ||
)} | ||
{sponsor.twitter && ( | ||
<a | ||
href={`https://twitter.com/${sponsor.twitter}`} | ||
target="_blank" | ||
rel="noreferrer" | ||
className=""> | ||
<div className="fa-stack"> | ||
<FontAwesomeIcon className="fa-stack-2x" icon={faCircle} color="white" /> | ||
<FontAwesomeIcon className="social-icon fa-stack-1x" icon={faXTwitter} /> | ||
</div> | ||
</a> | ||
)} | ||
{sponsor.linkedin && ( | ||
<a | ||
href={`https://www.linkedin.com/in/${sponsor.linkedin}`} | ||
target="_blank" | ||
rel="noreferrer"> | ||
<div className="fa-stack"> | ||
<FontAwesomeIcon className="fa-stack-2x" icon={faCircle} color="white" /> | ||
<FontAwesomeIcon className="social-icon fa-stack-1x" icon={faLinkedinIn} /> | ||
</div> | ||
</a> | ||
)} | ||
{sponsor.github && ( | ||
<a href={`https://github.com/${sponsor.github}`} target="_blank" rel="noreferrer"> | ||
<div className="fa-stack"> | ||
<FontAwesomeIcon className="fa-stack-2x" icon={faCircle} color="white" /> | ||
<FontAwesomeIcon className="social-icon fa-stack-1x" icon={faGithubAlt} /> | ||
</div> | ||
</a> | ||
)} | ||
{sponsor.gitlab && ( | ||
<a href={`https://gitlab.com/${sponsor.gitlab}`} target="_blank" rel="noreferrer"> | ||
<div className="fa-stack"> | ||
<FontAwesomeIcon className="fa-stack-2x" icon={faCircle} color="white" /> | ||
<FontAwesomeIcon className="social-icon fa-stack-1x" icon={faGitlab} /> | ||
</div> | ||
</a> | ||
)} | ||
{sponsor.website && ( | ||
<a href={sponsor.website} target="_blank" rel="noreferrer"> | ||
<div className="fa-stack"> | ||
<FontAwesomeIcon className="fa-stack-2x" icon={faCircle} color="white" /> | ||
<FontAwesomeIcon className="social-icon fa-stack-1x" icon={faGlobe} /> | ||
</div> | ||
</a> | ||
)} | ||
</div> | ||
</Col> | ||
</Row> | ||
<Row className="justify-content-center"> | ||
<Col xs={12} md={10}> | ||
<div className=""> | ||
{sponsor.description ? <p>{sponsor.description[lang]}</p> : null} | ||
</div> | ||
</Col> | ||
<Col xs={12} md={10}> | ||
<div className="button-wrapper"> | ||
<Button | ||
variant="primary" | ||
href={`${sponsor.url}`} | ||
target="_blank" | ||
className="button-submit"> | ||
Know more | ||
</Button> | ||
</div> | ||
</Col> | ||
</Row> | ||
</Container> | ||
</div> | ||
</section> | ||
); | ||
}; | ||
|
||
Sponsors.propTypes = { | ||
sponsor: PropTypes.object, | ||
talks: PropTypes.array, | ||
lang: PropTypes.string | ||
}; | ||
|
||
export default Sponsors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react'; | ||
import propTypes from 'prop-types'; | ||
import { notFound } from 'next/navigation'; | ||
|
||
import sponsorsList from '@/data/sponsors.json'; | ||
import en from '@/data/dictionaries/en.json'; | ||
import es from '@/data/dictionaries/es.json'; | ||
import Sponsors from './Sponsors'; | ||
|
||
export async function generateStaticParams() { | ||
const allPages = []; | ||
|
||
for (const level in sponsorsList) { | ||
for (const sponsor in sponsorsList[level]) { | ||
if (sponsor.id) { | ||
allPages.push({ uniquepage: sponsor.id.toString(), level }); | ||
} | ||
} | ||
} | ||
|
||
return allPages; | ||
} | ||
|
||
export async function generateMetadata({ params: { uniquepage, lang } }, parent) { | ||
const dataLang = lang === 'en' ? en : es; | ||
const dataSection = dataLang?.sections; | ||
const speakersData = dataSection.sponsors; | ||
let sponsorName = uniquepage; | ||
let sponsorDescription = ''; | ||
|
||
for (const level in sponsorsList) { | ||
for (const sponsor in sponsorsList[level]) { | ||
const data = sponsorsList[level][sponsor]; | ||
if (data.id && data.id.toString() === uniquepage) { | ||
sponsorName = data.name; | ||
sponsorDescription = level; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
return { | ||
title: `${sponsorName} - ${speakersData.title}`, | ||
description: sponsorDescription, | ||
openGraph: { | ||
title: sponsorName, | ||
description: sponsorDescription | ||
} | ||
}; | ||
} | ||
|
||
const Sponsor = ({ params: { uniquepage, lang } }) => { | ||
let sponsorData = null; | ||
let sponsorLevel = null; | ||
|
||
for (const level in sponsorsList) { | ||
for (const sponsor in sponsorsList[level]) { | ||
const data = sponsorsList[level][sponsor]; | ||
if (data.id && data.id.toString() === uniquepage) { | ||
sponsorData = data; | ||
sponsorLevel = level; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if (!sponsorData) { | ||
console.info('sponsor not found'); | ||
notFound(); | ||
} | ||
|
||
return <Sponsors level={sponsorLevel} sponsor={sponsorData} lang={lang} />; | ||
}; | ||
|
||
Sponsor.propTypes = { | ||
params: propTypes.shape({ | ||
uniquepage: propTypes.string, | ||
lang: propTypes.string | ||
}) | ||
}; | ||
|
||
export default Sponsor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters