Skip to content
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

Added more customizations to Avatar #903

Merged
merged 5 commits into from
Jun 6, 2018
Merged

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Jun 5, 2018

Addresses but doesn't completely fix issue #693

The following props were added:

  • color: Accepts hex value #FFFFFF, #000 otherwise a viz palette color will be assigned
  • initialsLength: Specify how many characters to show (max 2 allowed). By default, will show based on number of words.
  • initials: Custom initials (max 2 characters). By default will take the first character (of each word).
  • type The type of avatar is this displaying ("user" or "space")

Some new examples in the docs:

screen shot 2018-06-05 at 16 47 40 pm


  • Tested in IE
  • Accessibility (no changes should have been made to this)

cc @legrego

@cchaos cchaos requested review from chandlerprall and snide June 5, 2018 20:53

@if $type == 'light' {
$color: rgba(255, 255, 255, $alpha);
$color: rgba($euiColorEmptyShade, $alpha);
Copy link
Contributor Author

@cchaos cchaos Jun 5, 2018

Choose a reason for hiding this comment

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

@snide I'm not sure if these are breaking changes or not since it's changing out a hard-coded color for a variable, though this variable changes depending on the theme. The mixin is currently only used in the avatar SASS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@snide would you consider this a breaking change?

Copy link
Contributor

Choose a reason for hiding this comment

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

No. Think you're good.

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Looks great. Only question is whether you think we should be this loose with the initials. For example, "Ki" vs. "KI" vs. "ki". Should the capitalization be defined by the type itself? RIght now there's room for variance depending upon how they format the string.

Just posing the question. Don't know that I have a good answer. This is certainly the most flexible so it's fine. It's also something we can change later if abused.

{...rest}
>
{optionalInitial}
</div>
);
};

function checkValidColor(props, propName, componentName) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a todo comment in here (or just make an issue) to migrate to the check color service once the color picker goes in. I spent some time making this stuff generic, and it'll be easy to switch out.

font-size: $euiSizeL;
}
// Modifiers for sizing.
$avatarSizing: (
Copy link
Contributor

Choose a reason for hiding this comment

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

Much better

@cchaos
Copy link
Contributor Author

cchaos commented Jun 5, 2018

@snide

I thing the flexibility is fine here and don't feel like it will get abused when there's only 2 characters to available.

@cchaos
Copy link
Contributor Author

cchaos commented Jun 6, 2018

@chandlerprall I'm going to merge this in since I know you're busy this week, maybe you can take a quick post-mortem look when you're back.

@cchaos cchaos merged commit 6d08912 into elastic:master Jun 6, 2018
@cchaos cchaos deleted the spaces-avatar branch June 6, 2018 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants