Skip to content

Commit

Permalink
Merge pull request #83 from Naova/press-section-remake
Browse files Browse the repository at this point in the history
Refonte de la section Presse
  • Loading branch information
imrashb committed Mar 23, 2024
2 parents b5b8a6f + 0dd25da commit f52a49a
Show file tree
Hide file tree
Showing 14 changed files with 220 additions and 133 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Team from "./containers/Team/Team";
import Sponsors from "./containers/Sponsors/Sponsors";
import Press from "./containers/Press/Press";
import Scientific from "./containers/Scientific/Scientific";
import Historique from "./containers/Historique/Historique";

import messages from "./messages";
// import "./style/bootstrap.min.css";
Expand Down
12 changes: 6 additions & 6 deletions src/components/Press/ListOfPress.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React, { Component } from "react";
import Press from "./Press";

import "./press.css";
import PressYearSection from "./PressYearSection";

const press_data = require("../../json/press.json");

class ListOfPress extends Component {
render() {
const availableYears = press_data.map(p => new Date(p.date).getFullYear());
const uniqueYears = [...new Set(availableYears)].sort().reverse();
return (
<div>
<center>
<div className="container naova_press_section">
<div>
{press_data.map((p, i) => {
return <Press key={i} title={p.title} lang={p.lang} type={p.type} idDate={p.idDate} defaultMessageDate={p.defaultMessageDate} resume={p.resume} link={p.link} source={p.source}/>
})}
</div>
{uniqueYears.map((year, i) => {
return <PressYearSection key={i} year={year} />;
})}
</div>
</center>
</div>
Expand Down
38 changes: 0 additions & 38 deletions src/components/Press/Press.jsx

This file was deleted.

44 changes: 44 additions & 0 deletions src/components/Press/PressCard.jsx
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
31 changes: 31 additions & 0 deletions src/components/Press/PressYearSection.jsx
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
112 changes: 111 additions & 1 deletion src/components/Press/press.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,114 @@
color: #fff;
background-color: #bf003b;
border-color: black;
}
}

.press-card {
background: rgb(100,100,100);
border-radius: 1rem;
display: flex;
flex-direction: column;
align-items: start;
justify-content: start;
padding: 1rem;
margin: 1rem;
margin-bottom: 0rem;
flex: 1;
height: 24rem;
border: 2px solid black;
overflow: hidden;
position: relative;
cursor: pointer;
}

.press-card-title {
font-size: 1.5rem;
font-weight: 700;
color: white;
text-align: start;
margin-bottom: 0;
width: 100%;
z-index: 1;
}

.press-card-date {
font-size: 1rem;
font-weight: 400;
color: white;
text-align: center;
margin-bottom: 1rem;
z-index: 1;
font-style: italic;
}

.press-card-summary {
font-size: 1rem;
font-weight: 400;
color: white;
text-align: justify;
text-overflow: ellipsis;
flex: 1;
overflow-x: hidden;
overflow-y: auto;
margin: 0;
z-index: 1;
}

.press-card-summary::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #222222;
border-radius: 4rem;
}

.press-card-summary::-webkit-scrollbar
{
width: 6px;
background-color: #222222;
border-radius: 4rem;
}

.press-card-summary::-webkit-scrollbar-thumb
{
background-color: #f5f5f5;
border-radius: 4rem;
}

.press-section-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-column-gap: 16px;
grid-row-gap: 0px;
z-index: 1;
}

@media (max-width: 992px) {

.press-section-container {
display: grid;
grid-template-columns: repeat(1, 1fr);
grid-column-gap: 16px;
grid-row-gap: 0px;
z-index: 1;
}

}

.press-card-source {
margin-top: 1rem;
margin-bottom: 0;
font-size: 14px;
z-index: 1;
color: white;
}

.press-card-img {
height: 100%;
min-width: 100%;
margin: auto;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
filter: blur(5px) brightness(0.5);
position: absolute;
}
Binary file added src/img/press/eureka2018.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/press/firstgoal2018.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/press/porteouverte2019.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/press/robocupinternational2017.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/press/technofeminin2018.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f52a49a

Please sign in to comment.