-
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
Conversation
Hey, I've updated this PR in some ways:
The PR I mentioned above updates things on the github/github side. It gets rid of most of the css, and only leaves some app-specific styles. The team is looking to ship multiple attribution in about two weeks, so it'd be nice to get it into Primer before then 🙌 |
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.
Left some questions & thoughts!
|
||
// Temp tooltip class to position it correctly | ||
|
||
.temp-tooltipped-align-left { |
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.
Could we take this out of this PR?
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 can leave this in the temporary github/github css for now.
@@ -43,3 +43,114 @@ | |||
} | |||
} | |||
} |
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.
min-width: 36px; | ||
} | ||
|
||
&.AvatarStack--3 { |
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 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:
- Default
.AvatarStack
is for two (withwidth: 36px
) - There is a modifier for when a stack has more than two items, called
.AvatarStack--more
. Since theavatar-more
div always needs to be used in stacks with ≥3 items, that could be built into this class. This will lead to cleaner markup, which will reduce the chances of the component being implemented incorrectly.
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 don't think AvatarStack--more
would work, though. Everywhere avatar stacks are currently being used (notifications, projects, commit authors), there is often a single avatar.
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 AvatarStack--more
and AvatarStack--one
for these cases, but making the default 2 avatars feels a bit arbitrary. What do you think?
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 comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
} | ||
|
||
.AvatarStack-body { |
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'm curious to have @broccolini weigh in here about .AvatarStack
as the containing div that .AvatarStack-body
is positioned absolutely within.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
@sophshep I think this might actually align with that principle.
Separate container and content: Essentially, this means “rarely use location-dependent styles”. A component should look the same no matter where you put it.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated AvatarStack
to apply position: absolute;
to AvatarStack-body
so that it partially addresses mine and @sophshep's concern's (above) re tying the positioning into this component (but not entirely since you have width in the block class).
@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 AvatarStack
(like many things). We want to move to more consistent usage around width and height values so they would point to variables or use utilities, have more layout objects (incl. starting to use CSS grid), and I think we'll have other components that will require this same "stack" treatment than just avatars. But I'm fine with this shipping in the interest of having this for your feature, and it will give us an opportunity to test the new version out.
Hey folks, I've been thinking about this over the weekend following Friday's discussion with @sophshep @califa. I thought of a way we can pull this out of v10 without putting pressure on our team to do a v11 release earlier than planned. It occurred to me we can ship the avatar stack update in a follow-up minor release (rather than major) because we have different class names for the new styles. This enables us to add a deprecation warning for the old class names when this is ready to be released, and keep that deprecation warning until we're ready to do a new major release and remove the old styles. Considering all the risks for trying to include this in v10—between stress some folks are feeling, that there is more work still to be done, and reviews needed—I think we should pull avatar stack updates out of the v10 release, and ship in a follow-up minor release with the deprecation warning. What does this mean in the context of github/github?When we pull in the minor release with both the old and new styles, we'll see a deprecation warning when we install, but that won't be good prevention at hubbers using instances of the old styles. We need to look into other methods to warn people not to use soon-to-be-deprecated styles anyway, so we'll make that a priority after v10 ships so that we can hopefully come up with something in time for the avatar stack ship. cc @jonrohan who will likely be the person actually writing the scripts. Why didn't you suggest this earlier?Initially my concern was having to rush a v11 release or ship one without anything much in it, if the avatar-stack changes didn't make it into v10. But we can avoid that problem with the deprecation warning. We only recently introduced the deprecation warning which was the first part of figuring out what our process should be—basically we're still learning what works best, what we need to do, and what's possible (with 2 people and limited time). We are also still figuring out a good cadence for releases—this is our first major release after doing a string of releases for the new publishing flow, so we're also still learning what's best for our release process. If it's any consolation, the v10 release is proving to be a great learning experience, so following releases and documentation around process should provide more clarity. Next steps
I will also be reviewing what else we have on the list for v10 with @jonrohan on Monday, and prioritize what should go into v10 vs a follow-up minor release. I'll write that up and share with everyone currently contributing on Monday for feedback. |
@broccolini Thanks for putting this together! I'm comfortable with this as long as we can definitely hit my team's ship deadline (you're correct about the 2 weeks, I'll get you an exact date tomorrow). I'm free to start working on the changes 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.
Suggested a couple of changes but shouldn't affect you testing on GitHub. Let me know how things go!
min-width: 36px; | ||
} | ||
|
||
&.AvatarStack--3 { |
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.
} | ||
} | ||
|
||
.AvatarStack-body { |
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've updated AvatarStack
to apply position: absolute;
to AvatarStack-body
so that it partially addresses mine and @sophshep's concern's (above) re tying the positioning into this component (but not entirely since you have width in the block class).
@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 AvatarStack
(like many things). We want to move to more consistent usage around width and height values so they would point to variables or use utilities, have more layout objects (incl. starting to use CSS grid), and I think we'll have other components that will require this same "stack" treatment than just avatars. But I'm fine with this shipping in the interest of having this for your feature, and it will give us an opportunity to test the new version out.
position: relative; | ||
z-index: 2; | ||
display: flex; | ||
width: 20px; |
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.
Sorry I derped! Please leave as is.
modules/primer-avatars/README.md
Outdated
|
||
```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"> |
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?
modules/primer-avatars/README.md
Outdated
</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 comment
The 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:
Use
AvatarStack--right
to right-align the avatar stack and switch the origin of the tooltips.
"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:
Use
AvatarStack--right
to right-align the avatar stack. Remember to switch the alignment of tooltips when making this change.
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.
👍
This PR is the start of adding @califa's updated Avatar Stack pattern to Primer.
Here is what I've done so far:
.temp-avatar-stack
to.AvatarStack
so that this is all ready to switch over to our new naming convention. I'm leaving the existing CSS foravatar-stack
so that nothing breaks during testing, but eventually we should 🔥 that class..AvatarStack
to StorybookWhat's next?
temp-tooltipped-align-left
class in hereavatar-stack
from CSS & docs/cc @primer/ds-core @califa