Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

feat(Avatar): adding alt property #124

Merged
merged 4 commits into from
Jul 20, 2018
Merged

Conversation

mnajdova
Copy link
Collaborator

Avatar

Adding alt property to the Avatar component, for propagation to the Image component.

Proposed API:

alt

<Avatar src="path/to/image.jpg" alt="Profile picture of Matt" />

Result:

<div class="ui-avatar f g h">
  <img src="path/to/image.jpg" alt="Profile picture of Matt" class="ui-image f g i q i" />
</div>

@codecov
Copy link

codecov bot commented Jul 19, 2018

Codecov Report

Merging #124 into master will not change coverage.
The diff coverage is 66.66%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #124   +/-   ##
=======================================
  Coverage   69.94%   69.94%           
=======================================
  Files          74       74           
  Lines        1198     1198           
  Branches      227      227           
=======================================
  Hits          838      838           
  Misses        355      355           
  Partials        5        5
Impacted Files Coverage Δ
src/components/Avatar/Avatar.tsx 76% <66.66%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a1f7383...1225c3c. Read the comment docs.

<Avatar src="/public/images/avatar/small/matt.jpg" alt="Profile picture of Matt" />
)

export default AvatarExampleAltShorthand
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit odd. Some components won't have shorthand examples, such as this Avatar. Unless the avatar were used in another component like this:

<SomeComponent
  avatar={{ src: '//placehold.it/100', alt: 'A placeholder image' }}
/>

It seems we should not require certain components like Avatar to show shorthand. Let's plan on fixing that. No need to block this PR though.

@@ -9,6 +9,11 @@ const Variations = () => (
description="An Avatar can show the image of the user."
examplePath="components/Avatar/Variations/AvatarExampleSrc"
/>
<ComponentExample
title="Alt"
description="An Avatar showing image can propagate the alternative text to the image."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very helpful description. Grammar suggestion:

An Avatar can specify alternative text for the image.


static rules = avatarRules

static variables = avatarVariables

static propTypes = {
/** The alternative text for the image used in the Avatar. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a nice description as well and has good grammar. It could also be used in the docs if you prefer it over my other suggestion.

Copy link
Member

@levithomason levithomason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update alt description grammar using one of the suggestions.

@kuzhelov kuzhelov merged commit c57ddcc into master Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants