Code refactoring

> Utilisation d'une variable unique pour les experienceCard
This commit is contained in:
Anthony Dumas 2021-01-03 00:48:49 +01:00
parent 8e2865cf19
commit 69284d3300
5 changed files with 19 additions and 33 deletions

File diff suppressed because one or more lines are too long

View File

@ -11,31 +11,32 @@ export default class ExperienceCard extends Component {
// this.state = {};
// }
render() {
var imgSrc = this.props.logo;
var data = this.props.data;
var imgSrc = data.logo;
return <div class="card-content">
<div class="media">
<div class="media-left">
<a href={this.props.lienLogo}>
<a href={data.url}>
<figure class="image is-48x48">
<img src={imgSrc} alt="Logo Entreprise"/>
</figure>
</a>
</div>
<div class="media-content">
<p class="title is-4">{this.props.title}</p>
<p class="subtitle is-6">{this.props.nomEntreprise} - {this.props.lieuEntreprise} - {this.props.date}</p>
<p class="title is-4">{data.occupation}</p>
<p class="subtitle is-6">{data.entreprise} - {data.location} - {data.duration}</p>
<div class="tags">
{this.props.tags.map(function(name, index){
{data.tags.map(function(name, index){
return <span key={ index } class="tag">{name}</span>;
})}
</div>
</div>
</div>
<div class="content">
{this.props.descriptionEmploi}
{data.description}
</div>
{this.props.commentaire ? <div class="comment">
{this.props.commentaire}
{data.commentaire ? <div class="comment">
{data.commentaire}
</div> : ''}
</div>

View File

@ -67,27 +67,12 @@ class MainCard extends Component {
<span class="title">{experienceCardMessage.title}</span>
{experienceCardMessage.experiences.map(function(experience, index){
return <ExperienceCard
nomEntreprise={experienceCardMessage.experiences[index].entreprise}
lieuEntreprise={experienceCardMessage.experiences[index].location}
descriptionEmploi={experienceCardMessage.experiences[index].description}
title={experienceCardMessage.experiences[index].ocupation}
date={experienceCardMessage.experiences[index].duration}
lienLogo={experienceCardMessage.experiences[index].url}
logo={experienceCardMessage.experiences[index].logo}
tags={experienceCardMessage.experiences[index].tags}/>;
data={experience}/>;
})}
<span class="title">Education</span>
{experienceCardMessage.education.map(function(experience, index){
{experienceCardMessage.education.map(function(education, index){
return <ExperienceCard
nomEntreprise={experienceCardMessage.education[index].entreprise}
lieuEntreprise={experienceCardMessage.education[index].location}
descriptionEmploi={experienceCardMessage.education[index].description}
title={experienceCardMessage.education[index].ocupation}
date={experienceCardMessage.education[index].duration}
lienLogo={experienceCardMessage.education[index].url}
logo={experienceCardMessage.education[index].logo}
tags={experienceCardMessage.education[index].tags}
commentaire={experienceCardMessage.education[index].commentaire}/>;
data={education}/>;
})}
</div>

View File

@ -5,7 +5,7 @@
"title" : "Experience",
"experiences" : [
{
"ocupation" : "Full Stack Developer",
"occupation" : "Full Stack Developer",
"logo" : "../../logos/harvest.fr.png",
"url" : "https://www.harvest.fr",
"duration" : "(since 2016)",
@ -21,7 +21,7 @@
]
},
{
"ocupation" : "Internship as IOT Developer",
"occupation" : "Internship as IOT Developer",
"logo" : "../../logos/michelin.png",
"url" : "https://www.michelin.fr",
"duration" : "2015",
@ -38,7 +38,7 @@
],
"education" : [
{
"ocupation" : "Associate's Degree in Computer Science / Digital Imaging *",
"occupation" : "Associate's Degree in Computer Science / Digital Imaging *",
"logo" : "../../logos/www.iut-clermont.png",
"url" : "https://www.iut-clermont.fr/",
"duration" : "Class of 2015",

View File

@ -5,7 +5,7 @@
"title" : "Experience",
"experiences" : [
{
"ocupation" : "Développeur Full Stack",
"occupation" : "Développeur Full Stack",
"logo" : "../../logos/harvest.fr.png",
"url" : "https://www.harvest.fr",
"duration" : "(depuis 2016)",
@ -21,7 +21,7 @@
]
},
{
"ocupation" : "Stagiaire Développeur Internet des Objets",
"occupation" : "Stagiaire Développeur Internet des Objets",
"logo" : "../../logos/michelin.png",
"url" : "https://www.michelin.fr",
"duration" : "2015",
@ -38,7 +38,7 @@
],
"education" : [
{
"ocupation" : "DUT Informatique - Imagerie Numérique",
"occupation" : "DUT Informatique - Imagerie Numérique",
"logo" : "../../logos/www.iut-clermont.png",
"url" : "https://www.iut-clermont.fr/",
"duration" : "Promotion 2015",