Skip to content

Commit

Permalink
Merge pull request #6 from Astarosa/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Astarosa authored Apr 30, 2020
2 parents 6ecad16 + 768e084 commit b44e6c4
Show file tree
Hide file tree
Showing 33 changed files with 571 additions and 63 deletions.
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${file}"
}
]
}
31 changes: 31 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.19.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1",
Expand Down
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="https://image.flaticon.com/icons/png/512/8/8913.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand All @@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Evad'Art</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
55 changes: 47 additions & 8 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,52 @@
import React from 'react';
import './Styles/App.css';
import Home from './Pages/Home';

function App() {
return (
<div className="App">
<Home />
</div>
);
import Header from './Components/Header';
import axios from 'axios';
import PeriodsList from './Components/PeriodsList';

class App extends React.Component {
constructor (props) {
super(props);
this.state = {
backgroundImageUrl: '',
isLoaded:false
};
}

getBackGroundImage = async () => {
const backgroundIndex = Math.round(Math.random() * 714);
const ids = await axios.get('https://collectionapi.metmuseum.org/public/collection/v1/search?q=a&departmentIds=9')
.then(res => res.data)
.then(data => data.objectIDs);

const url = await axios.get(`https://collectionapi.metmuseum.org/public/collection/v1/objects/${ids[backgroundIndex]}`)
.then(result => result.data)
.then(data => data.primaryImageSmall);
this.setState({ backgroundImageUrl: url, isLoaded: true });
}

componentDidMount () {
this.timerID = setInterval(() => {
this.getBackGroundImage();
}, 4000);
this.getBackGroundImage();
}

componentWillUnmount () {
clearInterval(this.timerID);
}

render () {
return (
<div className='App'>
<Header isLoaded={this.state.isLoaded} backgroundImageUrl={this.state.backgroundImageUrl} />
<h2 className='intro'>Au fil des époques, l'art s'est exprimé de différentes manières. S'il est difficile l'appréhender, rien n'est laissé au hasard. Pour voyager au sein du MetMuseum et découvrir l'art à différentes époques depuis votre canapé, suivez le guide !</h2>
<PeriodsList />
<h2 className='intro'>"L'histoire des artistes ne peut être racontée qu'une fois que sont devenues claires, après un certain laps de temps, l'influence que leur oeuvre a exercé sur d'autres et les contributions qu'ils ont faites à l'histoire de l'art en tant que telle"</h2>
<h3 className='author-quote'>Ernst Gombrich</h3>
</div>
);
}
}

export default App;
12 changes: 0 additions & 12 deletions src/Components/Banner.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/Components/Button.js

This file was deleted.

13 changes: 13 additions & 0 deletions src/Components/Header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import '../Styles/Header.css';

const Header = (props) => {
return (
<header className={props.isLoaded ? 'banner-background' : 'banner-background wait'} style={{ backgroundImage: `linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4)), url(${props.backgroundImageUrl})` }}>
<h1>EVAD'ART</h1>
<h2>- Comprendre l'art au fil des époques -</h2>
</header>
);
};

export default Header;
56 changes: 56 additions & 0 deletions src/Components/Period.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react';
import '../Styles/Period.css';
import GetPeriodObjects from '../Requests/GetPeriodObjects';

// Ici class Period qui donne le squelette d'une periode affichée, avec les props title, date (remplacer le contneu du h3) plus le contenu

class Period extends React.Component {
constructor (props) {
super(props);
this.state = {
open: false,
isLoaded: false,
periodObjects: []
};
}

handleOpen = async () => {
const open = !this.state.open;
this.setState({ open });
const periodObjects = await GetPeriodObjects(this.props.request, this.props.id);
console.log(periodObjects);
this.setState({ periodObjects, isLoaded: true });
}

render () {
return (
<div className='period-bloc-container'>
<div className={this.state.open ? 'period-bloc-banner opened' : 'period-bloc-banner closed'} style={{ backgroundImage: `linear-gradient(to bottom, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.4)), url(${this.props.url})` }}>
<h2>{this.props.title}</h2>
<h3>{this.props.date}</h3>
<button onClick={this.handleOpen} className='open-content-container'>
<span className={this.state.open ? 'close-content' : 'open-content'} />
</button>
</div>
<div className={this.state.open ? 'period-bloc-content opened' : 'period-bloc-content closed'}>
<p className='period-content'>{this.props.content.text}</p>
<img className='period-illustration' src={this.props.content.illustration} alt={this.props.description} />
<p className='period-description'>{this.props.content.description}</p>
<div className='discover-object-container'>
<h4>Explorer des oeuvres de cette période</h4>
{this.state.isLoaded === false ? <div className='loading' />
: this.state.periodObjects.slice(0, 3).map(object => (
<div className='object-container' key={object.objectURL}>
<a href={object.objectURL} target='_blank' rel='noopener noreferrer'><div className='object-image-container' style={{ backgroundImage: `url(${object.primaryImageSmall})` }} /></a>
<h5>{object.title}</h5>
<h6>{object.artistDisplayName !== '' ? object.artistDisplayName : 'artiste inconnu'}</h6>
</div>
))}
</div>
</div>
</div>
);
}
}

export default Period;
18 changes: 18 additions & 0 deletions src/Components/PeriodsList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import Period from './Period';
import periods from '../Requests/periods';

class PeriodsList extends React.Component {
render () {
return (
<div className='all-period-bloc-container'>
<div className='time-arrow' />
{periods.map(period => (
<Period key={period.id} title={period.title} date={period.date} content={period.content} url={period.url} request={period.request} id={period.id} />
))}
</div>
);
}
}

export default PeriodsList;
12 changes: 0 additions & 12 deletions src/Components/Timeline.js

This file was deleted.

Binary file added src/Images/art-antique.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/Images/art-egyptien.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/Images/art-medieval-illustration-1.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/Images/art-medieval.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/Images/art-moderne-illustration-1.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/Images/art-moderne.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/Images/loading-2.gif
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/Images/open-period.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/Images/violons_et_raisins.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 0 additions & 12 deletions src/Pages/Home.js

This file was deleted.

24 changes: 24 additions & 0 deletions src/Requests/GetPeriodObjects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import axios from 'axios';

const modernArtObjects = [488098, 488142, 485536, 490210];

const GetPeriodObjects = async (q, deptId) => {
if (deptId === 9) {
const objectList = await Promise.all(modernArtObjects.map(objectId => {
return axios.get(`https://collectionapi.metmuseum.org/public/collection/v1/objects/${objectId}`)
.then(result => result.data);
}));
return objectList;
} else {
const objectIds = await axios.get(`https://collectionapi.metmuseum.org/public/collection/v1/search?q=${q}&departmentId=${deptId}`)
.then(res => res.data)
.then(data => data.objectIDs);
const objectList = await Promise.all(objectIds.map(objectId => {
return axios.get(`https://collectionapi.metmuseum.org/public/collection/v1/objects/${objectId}`)
.then(result => result.data);
}));
return objectList;
}
};

export default GetPeriodObjects;
67 changes: 67 additions & 0 deletions src/Requests/periods.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import artEgyptien from '../Images/art-egyptien.jpg';
import artGrecRomain from '../Images/art-antique.jpg';
import artMedieval from '../Images/art-medieval.jpg';
import artModerne from '../Images/art-moderne.jpg';
import artMedievalIllustrationUne from '../Images/art-medieval-illustration-1.jpg';
import artModerneIllustrationUne from '../Images/art-moderne-illustration-1.jpg';

// Ici mettre un tableau en dur des periodes (periods) qu'on veut afficher, avec des objets {key=id:, title:, date:, content: }
// Puis le composant PeriodList sous forme de fonction qui map periods, et qui pour chaque period , passe le composant
// Period , en lui passant une key unique (l'id de la période,), le title la date, et le contenu.

const periods = [
{
id: 10,
request: 'egypt',
title: 'Art Egyptien',
date: '3150 av. .J-C. - 150 av. .J-C.',
content:
{
text: "L'art Egyptien n'est pas \"primitif\" au sens des peintures rupestres. Si les bas-reliefs sont une représentation tronquée de la nature, c'est une volonté des Egyptiens. En effet, leur but n'est pas de faire une représentation exacte de la réalité, il est bien plus important d'en faire une représentation complète: la tête se voit mieux de profil, le torse de face, les bras et les jambes de profil, etc. Pour la première fois, on peut parler de \"style\".",
illustration: 'https://ekladata.com/3B7IUx3anXzGBOPMKFSpyuvXltE.jpg',
description: 'Le style Egyptien'
},
url: artEgyptien
},
{
id: 13,
request: 'sculpture',
title: 'Art Grec et Romain',
date: 'VIIème siècle av. .J-C. - Ier siècle ap. .J-C.',
content:
{
text: "L'art Grec apporte une grande nouveauté : le but n'est plus d'imiter avec la plus grande fidélité possible le style des anciens mais, pour chaque sculpteur, de décider par lui même comment il va représenter le corps, chacun reprenant les grands succès des autres : comment réussir un torse, réaliser que la statue est plus vivante si le pied est légèrement soulevé, remarquer qu'un léger sourire rend sympa. L'idée générale est : \"n'imitez pas, innovez\". On invente le raccourci.",
illustration: 'https://idata.over-blog.com/4/08/12/30/raccourci/Euthymides---detail2.JPG',
description: "L'invention du raccourci : un pied de profil et l'autre de face"
},
url: artGrecRomain
},
{
id: 17,
request: 'medieval',
title: 'Art Médiéval',
date: 'Vème siècle ap. .J-C. - XIIIème siècle ap. .J-C.',
content:
{
text: "Avec le christianisme, la question de la place des images dans la religion se pose de manière renouvelée. Si pour tous les premiers chrétiens, il ne doit pas y avoir de représentation dans les églises, le Pape Grégoire le Grand, au IVème siècle, inverse la tendance. D'après lui, les images peuvent avoir un rôle d'enseignement pour les fidèles ne sachant pas lire. Le but n'est donc plus de représenter la réalité mais d'aller à l'essentiel pour plus de clarté et, ainsi, mieux éduquer.",
illustration: artMedievalIllustrationUne,
description: 'Peu importe les proportions, le message doit être le plus clair possible'
},
url: artMedieval
},
{
id: 9,
request: 'abstract',
title: 'Art Moderne',
date: 'XXème siècle ap. .J-C.',
content:
{
text: "Faut il impérativement représenter une toile reconnaissable pour pouvoir exprimer ses sentiments.Le cap est franchit par le peintre russe Wassily Kandisky , pionnier de l'art abstrait connu également sous le nom d'art décoratif. Picasso lui emboîtera le pas en s'inspirant du fauvisme issu de l'impressionnisme de Monnet , comme peut l'illustrer son oeuvre intitulée violon et raisin.",
illustration: artModerneIllustrationUne,
description: 'Violon et raisins, Pablo Picasso, 1912'
},
url: artModerne
}
];

export default periods;
5 changes: 4 additions & 1 deletion src/Styles/App.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.App {
text-align: center;
font-family:Montserrat;
margin:0 ;
padding: 0;
}

.App-logo {
Expand Down Expand Up @@ -35,4 +38,4 @@
to {
transform: rotate(360deg);
}
}
}
Empty file removed src/Styles/Banner.css
Empty file.
Empty file removed src/Styles/Button.css
Empty file.
Loading

0 comments on commit b44e6c4

Please sign in to comment.