-
Notifications
You must be signed in to change notification settings - Fork 55
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
adding default avatar image #88
base: master
Are you sure you want to change the base?
Conversation
Added the waiting on contributor label as @aspittel has asked @bhirmbani for a small change. |
Hi @bhirmbani @GaProgMan , I don't think this will solve this issue #71 problem. Let me explain in detail: {
"id": "reczp03Z88eFLuJDO",
"fields": {
"Name": "Muses Code JS",
"Tags": [
"JavaScript",
"WebDev"
],
"Blog": "http://nodegirls.com.au/",
"Website": "https://github.com/node-girls-australia",
"About": "...... removed for simplicity",
"Published": true
}
} As you can see there is no {project.Image && (
<div class="profileImageContainer">
<img
src={project.Image[0].thumbnails.large.url}
src={project.Image[0].thumbnails.large.url ? project.Image[0].thumbnails.large.url : 'https://api.adorable.io/avatars/285/learn-code-from-us-default-avtr.png'}
alt={"Picture of " + project.Name}
className="profileImage"
/>
</div>
)} Since there is no |
Ah yes, you're right. I didn't see the source. That should do the trick. But just curious, how is Musus could be no Image array at the first place? Is it possible to happening again in the future? In case of that how if we do something like the following:
|
@bhirmbani , This is a great solution. You don't even have to change <img
src={project.Image[0].thumbnails.large.url} // Like this
src={project.Image[0].thumbnails.large.url} // Like this
alt={"Picture of " + project.Name}
className="profileImage"
/> Go ahead, I'll close my pull request #91 |
Description
I just add ternary operator to the img tag source. If it have
project.Image[0].thumbnails.large.url
then load it. If it doesn't then load the default avatar that is a service from adorable avatar. maybe its too cute?Motivation and Context
I wrote this PR because Im motivated to fix the issue number #71
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: