-
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 13 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 |
---|---|---|
|
@@ -43,3 +43,114 @@ | |
} | ||
} | ||
} | ||
|
||
// Refactored, new avatar stack: | ||
|
||
.AvatarStack { | ||
position: relative; | ||
min-width: 26px; | ||
height: 20px; | ||
|
||
&.AvatarStack--2 { | ||
min-width: 36px; | ||
} | ||
|
||
&.AvatarStack--3 { | ||
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 should avoid using numerals in class names since they have the potential to be confused with spacer variables. The two variations for avatar stack component are 2 avatars and ≥3 avatars, right? If so, I'd suggest the following:
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 don't think If avatar stacks had a 2 avatar minimum, we'd have to implement logic every time we used this component to decide whether to use single avatar markup or a stack (as well as make sure the single avatar had the exact same styles/tooltips/etc to match its surrounding avatar stacks). That feels like a bad tradeoff for cleaner markup to me. We could possibly use I don't want to create confusion and I'm very open to using different class names, though. Any ideas? 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. |
||
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 |
||
position: absolute; | ||
padding-right: $spacer-1; | ||
background: $bg-white; | ||
|
||
.avatar { | ||
position: relative; | ||
z-index: 2; | ||
display: inline-block; | ||
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: -15px; | ||
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; | ||
margin-right: 0; | ||
border-right: 0; | ||
} | ||
|
||
// 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:nth-child(n+4) { | ||
display: inline-block; | ||
opacity: 1; | ||
} | ||
|
||
&:hover .avatar { | ||
margin-right: 0; | ||
} | ||
} | ||
|
||
.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 { | ||
z-index: 2; | ||
width: 14px; | ||
background: $gray-300; | ||
} | ||
|
||
&::after { | ||
width: 17px; | ||
background: $gray-200; | ||
} | ||
} | ||
|
||
.AvatarStack-body:hover .avatar-more { | ||
display: none; | ||
} | ||
|
||
// Temp tooltip class to position it correctly | ||
|
||
.temp-tooltipped-align-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. Could we take this out of this PR? 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 can leave this in the temporary github/github css for now. |
||
&::after { | ||
left: 0 !important; | ||
margin-left: 0 !important; | ||
} | ||
|
||
&::before { | ||
left: 5px !important; | ||
} | ||
} |
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.
I left
avatar-stack
in here when I started the PR to prevent breaking anything, but ideally we could take it out of Primer in favor of the refactored/redesigned component. Could we take it out here (and in replace it in github/github)?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.
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
@broccolini 👍 talked to @sophshep. I'm spending all day on this today.