-
Notifications
You must be signed in to change notification settings - Fork 18
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
[Opinionated] Add alt attribute & remove container #13
base: master
Are you sure you want to change the base?
Conversation
lib/ImageWorker.js
Outdated
); | ||
const { style, imageClass, alt } = this.props; | ||
const { isLoading, imgSrc } = this.state; | ||
return state.isLoading ? this.renderPlaceholder() : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isLoading
will be an unused variable.. you can change it to the following
return .isLoading ? this.renderPlaceholder() :
<img src={imgSrc}
style={{ ...style }} className={imageClass} alt={alt} />
So i converted it to a div because if someone supplies a placeholder as a display: inline-block |
Looks Good @nitish24p I think we can merge it :) |
One comment, and eslint.. |
can you run npm run eslint to see the lint errors and fix those |
Fixed! But I think it should be added to the readme, because as I said I'd expect an |
I've added an alt attribute, because "Placeholder" and "Worker" as
alt
is not really nice.Second thing I've done is remove the container, because if you're using
<ImageWorker>
as replacement for<img>
it should not become a<div>
.