-
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 #83 from Naova/press-section-remake
Refonte de la section Presse
- Loading branch information
Showing
14 changed files
with
220 additions
and
133 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,44 @@ | ||
import React from 'react' | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
const getImageLink = (article) => { | ||
const isYoutube = article.link.toLowerCase().includes('youtube') | ||
|
||
if(isYoutube) { | ||
|
||
const index = article.link.lastIndexOf("="); | ||
const videoId = article.link.substring(index+1, article.link.length) | ||
|
||
return `https://i3.ytimg.com/vi/${videoId}/maxresdefault.jpg` | ||
} | ||
|
||
if(article.image) { | ||
return require(`../../img/press/${article.image.toLowerCase()}`) | ||
} | ||
|
||
return require("../../img/logo/naoface.svg").default; | ||
|
||
} | ||
|
||
|
||
const PressCard = ({article}) => { | ||
const date = new Date(article.date) | ||
|
||
const image = getImageLink(article) | ||
|
||
return ( | ||
<div className="press-card" onClick={() => window.open(article.link, "_blank")}> | ||
<p className="press-card-title">{article.title}</p> | ||
<p className="press-card-date">{date.toLocaleDateString()}</p> | ||
<p className="press-card-summary">{article.resume}</p> | ||
<p className="press-card-source"> | ||
<FormattedMessage id="press.source" defaultMessage="Source: " /> | ||
{article.source} | ||
</p> | ||
<img src={image} className="press-card-img" /> | ||
</div> | ||
|
||
) | ||
} | ||
|
||
export default PressCard |
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,31 @@ | ||
import React from 'react' | ||
import SectionHeaderNao from '../SectionHeaderNao/SectionHeaderNao' | ||
import { FormattedHTMLMessage } from 'react-intl' | ||
import PressCard from './PressCard'; | ||
import "./press.css" | ||
|
||
const press_data = require("../../json/press.json"); | ||
|
||
const PressYearSection = ({year}) => { | ||
|
||
const yearData = press_data | ||
.filter(p => new Date(p.date).getFullYear() === year) | ||
.sort((a, b) => new Date(b.date) - new Date(a.date)); | ||
|
||
if(yearData.length === 0) return null; | ||
return ( | ||
<div> | ||
<SectionHeaderNao isBigNaoFace={false}> | ||
<FormattedHTMLMessage id="press.year" defaultMessage={`Year`} /> | ||
{' '}{year} | ||
</SectionHeaderNao> | ||
<div className="press-section-container"> | ||
{yearData.map((article, i) => { | ||
return <PressCard key={i} article={article} />; | ||
})} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default PressYearSection |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.