-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
New Avatar stack #385
New Avatar stack #385
Changes from 30 commits
2f1a72f
dbf4b84
20b3186
db3ef68
e003cd0
f0393d7
314b630
ef42395
e942b6d
ac78db0
6af7e76
bb5bd3b
b3d3ebb
0f6465d
e374740
ff7967f
a03d4e6
8cca4f5
9c57895
80fd1fa
251036d
a73abae
2fa1d34
ef0f1e5
da3ae73
6ab6594
9e9d9c1
7e491e2
03a3d75
8b99d32
4956549
c2a392f
8a1074a
9fec40d
29f2689
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,14 +75,54 @@ When you need a larger parent avatar, and a smaller child one, overlaid slightly | |
|
||
### Avatar stack | ||
|
||
Stacked avatars can be used to show who is participating in thread when there is limited space available. When you hover over the stack, the avatars will reveal themselves. Optimally, you should put no more than 3 avatars in the stack. | ||
Stacked avatars can be used to show multiple collaborators or participants when there is limited space available. When you hover over the stack, the avatars will reveal themselves. | ||
|
||
```html | ||
<span class="avatar-stack tooltipped tooltipped-s" aria-label="jonrohan, aaronshekey, and josh"> | ||
<img alt="@jonrohan" class="avatar" height="39" alt="jonrohan" src="/jonrohan.png" width="39"> | ||
<img alt="@aaronshekey" class="avatar" height="39" alt="aaronshekey" src="/aaronshekey.png" width="39"> | ||
<img alt="@josh" class="avatar" height="39" alt="josh" src="/josh.png" width="39"> | ||
</span> | ||
<div class="AvatarStack AvatarStack--three-plus tooltipped tooltipped-se temp-tooltipped-align-left" aria-label="jonrohan, aaronshekey, and josh"> | ||
<img alt="@jonrohan" class="avatar" height="20" alt="jonrohan" src="/jonrohan.png" width="20"> | ||
<img alt="@aaronshekey" class="avatar" height="20" alt="aaronshekey" src="/aaronshekey.png" width="20"> | ||
<img alt="@josh" class="avatar" height="20" alt="josh" src="/josh.png" width="20"> | ||
</div> | ||
``` | ||
|
||
Based on the number of avatars in the stack, add these modifier classes: | ||
- `AvatarStack--two` for 2 avatars. | ||
- `AvatarStack--three-plus` for 3 or more avatars. | ||
|
||
If you have more than three avatars, add a div with the classes `avatar avatar-more` as the third avatar in the stack, as such: | ||
|
||
```html | ||
<div class="AvatarStack AvatarStack--three-plus tooltipped tooltipped-se temp-tooltipped-align-left" aria-label="jonrohan, aaronshekey, and josh"> | ||
<img alt="@jonrohan" class="avatar" height="20" alt="jonrohan" src="/jonrohan.png" width="20"> | ||
<img alt="@aaronshekey" class="avatar" height="20" alt="aaronshekey" src="/aaronshekey.png" width="20"> | ||
<div class="avatar avatar-more"></div> | ||
<img alt="@josh" class="avatar" height="20" alt="josh" src="/josh.png" width="20"> | ||
<img alt="@josh" class="avatar" height="20" alt="josh" src="/josh.png" width="20"> | ||
<img alt="@josh" class="avatar" height="20" alt="josh" src="/josh.png" width="20"> | ||
</div> | ||
``` | ||
|
||
You can also link individual avatars. To do this shift the `avatar` class over to the anchor: | ||
|
||
```html | ||
<div class="AvatarStack AvatarStack--two tooltipped tooltipped-se temp-tooltipped-align-left" aria-label="jonrohan, aaronshekey, and josh"> | ||
<a href="#" class="avatar"> | ||
<img alt="@jonrohan" height="20" alt="jonrohan" src="/jonrohan.png" width="20"> | ||
</a> | ||
<a href="#" class="avatar"> | ||
<img alt="@josh" height="20" alt="josh" src="/josh.png" width="20"> | ||
</a> | ||
</div> | ||
``` | ||
|
||
If you'd like a right-aligned avatar stack, add the `AvatarStack--right` modifier class and switch the tooltips around: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trying to make our docs a bit more "to the point" and more of a command tense. Suggest:
"and switch the tooltips around" - it doesn't switch it though right? You have to manually change the tooltip classes? If so, we should make that clear. Suggest:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
```html | ||
<div class="AvatarStack AvatarStack--three-plus AvatarStack--right tooltipped tooltipped-sw temp-tooltipped-align-right" aria-label="jonrohan, aaronshekey, and josh"> | ||
<img alt="@jonrohan" class="avatar" height="20" alt="jonrohan" src="/jonrohan.png" width="20"> | ||
<img alt="@aaronshekey" class="avatar" height="20" alt="aaronshekey" src="/aaronshekey.png" width="20"> | ||
<img alt="@josh" class="avatar" height="20" alt="josh" src="/josh.png" width="20"> | ||
</div> | ||
``` | ||
|
||
## Circle Badge | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,137 @@ | |
} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I left There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We definitely could (and should!), but I don't think that's feasible by tomorrow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @califa we need to update all the instances of avatar in GitHub for this to ship. As I understand it, this pattern is to replace the current avatar stack, which means we need to ensure this pattern works everywhere it's being used. The best way to test this is to update the locations where this is being used. If you can't do that in time for v10 release, or you need help with that, then we'll need to discuss whether to pull it out of v10 or delay it by a few days. I'd prefer to get it into v10 because I think these changes will require a major release and I don't really want to do v11 straight after v10. For clarity on timeline, we want all v10 pr's merged in eod tomorrow, so that we can do a naming change on Monday and test, and then intend to ship Monday or Tuesday depending on how long it takes to test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @broccolini 👍 talked to @sophshep. I'm spending all day on this today. |
||
|
||
// Refactored, new avatar stack: | ||
|
||
.AvatarStack { | ||
position: relative; | ||
min-width: 26px; | ||
height: 20px; | ||
|
||
.AvatarStack-body { | ||
position: absolute; | ||
} | ||
|
||
&.AvatarStack-two { | ||
min-width: 36px; | ||
} | ||
|
||
&.AvatarStack-three-plus { | ||
min-width: 46px; | ||
} | ||
} | ||
|
||
.AvatarStack-body { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious to have @broccolini weigh in here about I spoke to @califa briefly on slack about this and he said that this component will always need to be positioned this way in order to interact with its surroundings as intended. This does, however, go against the principle of "separate container and content" and has the potential to lead to some unnecessary overrides in the future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sophshep I think this might actually align with that principle.
If we treat the container as part of the component as we're doing here, then it won't be location dependent. It'll always appear/behave exactly the same no matter where we put it. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've updated @califa - might be good if we have a longer discussion in person about our principles, I'd like to ensure they make sense to everyone and I understand how they might be interpreted differently. We haven't really updated them since we first started the design systems team, and I want to review and iterate on them, and ensure they tie back to product design principles so that we can use them as a framework to make decisions on both design and code more easily. To be honest I expect we'll need to iterate on |
||
display: flex; | ||
background: $bg-white; | ||
|
||
.avatar { | ||
position: relative; | ||
z-index: 2; | ||
display: flex; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this declaration do? (Things seem fine without it) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This gets rid of the weird white-space disparity caused by |
||
width: 20px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I derped! Please leave as is. |
||
height: 20px; | ||
box-sizing: content-box; | ||
margin-right: -11px; | ||
background-color: $bg-white; | ||
border-right: $border-width $border-style $white; | ||
border-radius: 2px; | ||
transition: margin 0.1s ease-in-out; | ||
|
||
&:first-child { | ||
z-index: 3; | ||
} | ||
|
||
&:last-child { | ||
z-index: 1; | ||
} | ||
|
||
// stylelint-disable selector-max-type | ||
img { | ||
border-radius: 2px; | ||
} | ||
// stylelint-enable selector-max-type | ||
|
||
// Account for 4+ avatars | ||
&:nth-child(n+4) { | ||
display: none; | ||
opacity: 0; | ||
} | ||
} | ||
|
||
&:hover { | ||
.avatar { | ||
margin-right: 3px; | ||
} | ||
|
||
.avatar:nth-child(n+4) { | ||
display: flex; | ||
opacity: 1; | ||
} | ||
|
||
.avatar-more { | ||
display: none !important; | ||
} | ||
} | ||
} | ||
|
||
.avatar.avatar-more { | ||
z-index: 1; | ||
margin-right: 0; | ||
background: $gray-100; | ||
|
||
&::before, | ||
&::after { | ||
position: absolute; | ||
display: block; | ||
height: 20px; | ||
content: ""; | ||
border-radius: 2px; | ||
outline: $border-width $border-style $white; | ||
} | ||
|
||
&::before { | ||
width: 17px; | ||
background: $gray-200; | ||
} | ||
|
||
&::after { | ||
width: 14px; | ||
background: $gray-300; | ||
} | ||
} | ||
|
||
// Right aligned variation | ||
|
||
.AvatarStack--right { | ||
.AvatarStack-body { | ||
right: 0; | ||
flex-direction: row-reverse; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Niiiiice |
||
|
||
&:hover .avatar { | ||
margin-right: 0; | ||
margin-left: 3px; | ||
} | ||
} | ||
|
||
.avatar.avatar-more { | ||
background: $gray-300; | ||
|
||
&::before { | ||
width: 5px; | ||
} | ||
|
||
&::after { | ||
width: 2px; | ||
background: $gray-100; | ||
} | ||
} | ||
|
||
.avatar { | ||
margin-right: 0; | ||
margin-left: -11px; | ||
border-right: 0; | ||
border-left: $border-width $border-style $white; | ||
} | ||
} |
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.
As mentioned in Slack, we're removing staff avatars from our docs and moving to using the octocat placeholder. Could you update to use this?
https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png
- let me know if you have trouble or don't have time.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.
👍
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.
@broccolini should I replace people w/ octocts for this entire readme file?