Skip to content

Solving Image heights for mentor thumbnails #142 #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package-lock.json

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

126 changes: 63 additions & 63 deletions src/components/MentorProfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react'
import React, { Component } from 'react'
import ReactImageFallback from "react-image-fallback";
import data from '../response/response'

Expand All @@ -8,86 +8,86 @@ import loader from '../assets/loader.gif';
import mentorImage from '../assets/mentor-default.svg';


class MentorProfile extends Component{
class MentorProfile extends Component {

state ={
state = {
mentorId: null,
mentorProfile:null
mentorProfile: null
}

componentDidMount(){
componentDidMount() {
let id = this.props.match.params.mentorId;

this.setState({
mentorId:id,
mentorId: id,
// eslint-disable-next-line
mentorProfile: data.filter(item=>item.id == id)[0]
mentorProfile: data.filter(item => item.id == id)[0]
});

}


render() {
const hasProfileData = this.state.mentorProfile ? (<div>
<div className="row mt-5 no-gutters">
<div className="col-sm-4 col-md-4 ">
<ReactImageFallback
src={this.state.mentorProfile.image}
fallbackImage={mentorImage} //this shows if the montor does not have any image
initialImage={loader}
alt={this.state.mentorProfile.name}
className="card-img mentor-img-thumbnail img-fluid" />
</div>
<div className="col-md-8">
<div className="card-body">
<h4 className="card-title">{this.state.mentorProfile.name}</h4>
<p className="card-text"><small className="text-muted">{this.state.mentorProfile.country}</small></p>
<p className="card-text">{this.state.mentorProfile.biography}</p>
<p className="card-text ">{this.state.mentorProfile.technology}</p>
const hasProfileData = this.state.mentorProfile ? (<div>
<div className="row mt-5 no-gutters">
<div className="col-sm-4 col-md-4 ">
<ReactImageFallback
src={this.state.mentorProfile.image}
fallbackImage={mentorImage} //this shows if the montor does not have any image
initialImage={loader}
alt={this.state.mentorProfile.name}
className="card-img mentor-img-thumbnail img-fluid" />

</div>

<div className="col-md-8">
<div className="card-body">
<h4 className="card-title">{this.state.mentorProfile.name}</h4>
<p className="card-text"><small className="text-muted">{this.state.mentorProfile.country}</small></p>
<p className="card-text">{this.state.mentorProfile.biography}</p>
<p className="card-text ">{this.state.mentorProfile.technology}</p>

</div>
</div>
</div>
</div>
</div>
<div className="row mt-3 no-gutters">
<div >
<h5 className="card-title">Technology Stack</h5>
<div className="">
{
this.state.mentorProfile.technology.split(',').map((item,key)=>{
let programmingLanguage = item.toLowerCase();

///below are icons generated by devicon
return<i key={key} className={`devicon-${programmingLanguage.trim()}-plain colored`}></i>

//if you would like to use Font Mfizz vector icons uncomment the line bellow
// return<i key={key} className={`icon-${programmingLanguage.trim()}`}></i>



})
}


<div className="row mt-3 no-gutters">
<div >
<h5 className="card-title">Technology Stack</h5>
<div className="">
{
this.state.mentorProfile.technology.split(',').map((item, key) => {
let programmingLanguage = item.toLowerCase();

///below are icons generated by devicon
return <i key={key} className={`devicon-${programmingLanguage.trim()}-plain colored`}></i>

//if you would like to use Font Mfizz vector icons uncomment the line bellow
// return<i key={key} className={`icon-${programmingLanguage.trim()}`}></i>



})
}


</div>
</div>

</div>
</div>

</div>
</div>) : (<h2>Loading Data</h2>)
</div>) : (<h2>Loading Data</h2>)



return (
<div>
<Header />
<div className="container">

{hasProfileData}

<div>
<Header />
<div className="container">

{hasProfileData}

</div>
</div>
</div>
)
}
}
}

export default MentorProfile;