-
Notifications
You must be signed in to change notification settings - Fork 646
chore(AvatarStack): Remove the CSS modules feature flag from the AvatarStack component #5871
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
Conversation
🦋 Changeset detectedLatest commit: 9095d07 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
size-limit report 📦
|
|
👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/371265 |
| type StyledAvatarStackWrapperProps = { | ||
| count?: number | ||
| } & SxProp | ||
|
|
||
| const CSS_MODULES_FEATURE_FLAG = 'primer_react_css_modules_ga' | ||
|
|
||
| const AvatarStackWrapper = toggleStyledComponent( | ||
| CSS_MODULES_FEATURE_FLAG, | ||
| 'span', | ||
| styled.span<StyledAvatarStackWrapperProps>` | ||
| --avatar-border-width: 1px; | ||
| --overlap-size: calc(var(--avatar-stack-size) * 0.55); | ||
| --overlap-size-avatar-three-plus: calc(var(--avatar-stack-size) * 0.85); | ||
| --mask-size: calc(100% + (var(--avatar-border-width) * 2)); | ||
| --mask-start: -1; | ||
| --opacity-step: 15%; | ||
| display: flex; | ||
| position: relative; | ||
| height: var(--avatar-stack-size); | ||
| min-width: var(--avatar-stack-size); | ||
| isolation: isolate; | ||
| .pc-AvatarStackBody { | ||
| display: flex; | ||
| position: absolute; | ||
| ${getGlobalFocusStyles('1px')} | ||
| } | ||
| .pc-AvatarItem { | ||
| --avatar-size: var(--avatar-stack-size); | ||
| flex-shrink: 0; | ||
| height: var(--avatar-stack-size); | ||
| width: var(--avatar-stack-size); | ||
| position: relative; | ||
| overflow: hidden; | ||
| display: flex; | ||
| transition: | ||
| margin 0.2s ease-in-out, | ||
| opacity 0.2s ease-in-out, | ||
| mask-position 0.2s ease-in-out, | ||
| mask-size 0.2s ease-in-out; | ||
| &:is(img) { | ||
| box-shadow: 0 0 0 var(--avatar-border-width) | ||
| ${props => (props.count === 1 ? get('colors.avatar.border') : 'transparent')}; | ||
| } | ||
| &:first-child { | ||
| margin-inline-start: 0; | ||
| } | ||
| &:nth-child(n + 2) { | ||
| margin-inline-start: calc(var(--overlap-size) * -1); | ||
| mask-image: radial-gradient(at 50% 50%, rgb(0, 0, 0) 70%, rgba(0, 0, 0, 0) 71%), | ||
| linear-gradient(rgb(0, 0, 0) 0 0); | ||
| mask-repeat: no-repeat, no-repeat; | ||
| mask-size: | ||
| var(--mask-size) var(--mask-size), | ||
| auto; | ||
| mask-composite: exclude; | ||
| // HORIZONTAL POSITION CALC FORMULA EXPLAINED: | ||
| // width of the visible part of the avatar ➡️ var(--avatar-stack-size) - var(--overlap-size) | ||
| // multiply by -1 for left-aligned, 1 for right-aligned ➡️ var(--mask-start) | ||
| // subtract the avatar border width ➡️ var(--avatar-border-width) | ||
| mask-position: | ||
| calc((var(--avatar-stack-size) - var(--overlap-size)) * var(--mask-start) - var(--avatar-border-width)) center, | ||
| 0 0; | ||
| // HACK: This padding fixes a weird rendering bug where a tiiiiny outline is visible at the edges of the element | ||
| padding: 0.1px; | ||
| } | ||
| &:nth-child(n + 3) { | ||
| --overlap-size: var(--overlap-size-avatar-three-plus); | ||
| opacity: calc(100% - 2 * var(--opacity-step)); | ||
| } | ||
| &:nth-child(n + 4) { | ||
| opacity: calc(100% - 3 * var(--opacity-step)); | ||
| } | ||
| &:nth-child(n + 5) { | ||
| opacity: calc(100% - 4 * var(--opacity-step)); | ||
| } | ||
| &:nth-child(n + 6) { | ||
| opacity: 0; | ||
| visibility: hidden; | ||
| } | ||
| } | ||
| &.pc-AvatarStack--two { | ||
| // MIN-WIDTH CALC FORMULA EXPLAINED: | ||
| // avatar size ➡️ var(--avatar-stack-size) | ||
| // plus the visible part of the 2nd avatar ➡️ var(--avatar-stack-size) - var(--overlap-size) | ||
| min-width: calc(var(--avatar-stack-size) + (var(--avatar-stack-size) - var(--overlap-size))); | ||
| } | ||
| &.pc-AvatarStack--three { | ||
| // MIN-WIDTH CALC FORMULA EXPLAINED: | ||
| // avatar size ➡️ var(--avatar-stack-size) | ||
| // plus the visible part of the 2nd avatar ➡️ var(--avatar-stack-size) - var(--overlap-size) | ||
| // plus the visible part of the 3rd avatar ➡️ var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus) | ||
| min-width: calc( | ||
| var(--avatar-stack-size) + (var(--avatar-stack-size) - var(--overlap-size)) + | ||
| (var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus)) | ||
| ); | ||
| } | ||
| &.pc-AvatarStack--three-plus { | ||
| // MIN-WIDTH CALC FORMULA EXPLAINED: | ||
| // avatar size ➡️ var(--avatar-stack-size) | ||
| // plus the visible part of the 2nd avatar ➡️ var(--avatar-stack-size) - var(--overlap-size) | ||
| // plus the visible part of the 3rd AND 4th avatar ➡️ (var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus)) * 2 | ||
| min-width: calc( | ||
| var(--avatar-stack-size) + (var(--avatar-stack-size) - var(--overlap-size)) + | ||
| (var(--avatar-stack-size) - var(--overlap-size-avatar-three-plus)) * 2 | ||
| ); | ||
| } | ||
| &.pc-AvatarStack--right { | ||
| --mask-start: 1; | ||
| direction: rtl; | ||
| } | ||
| .pc-AvatarStackBody:not(.pc-AvatarStack--disableExpand):hover, | ||
| .pc-AvatarStackBody:not(.pc-AvatarStack--disableExpand):focus-within { | ||
| width: auto; | ||
| .pc-AvatarItem { | ||
| // reset size of the mask to prevent unintentially clipping due to the additional size created by the border width | ||
| --mask-size: 100%; | ||
| margin-inline-start: ${get('space.1')}; | ||
| opacity: 1; | ||
| visibility: visible; | ||
| // HORIZONTAL POSITION CALC FORMULA EXPLAINED: | ||
| // width of the full avatar ➡️ var(--avatar-stack-size) | ||
| // multiply by -1 for left-aligned, 1 for right-aligned ➡️ var(--mask-start) | ||
| mask-position: | ||
| calc(var(--avatar-stack-size) * var(--mask-start)) center, | ||
| 0 0; | ||
| ${getGlobalFocusStyles('1px')} | ||
| &:first-child { | ||
| margin-inline-start: 0; | ||
| } | ||
| } | ||
| } | ||
| .pc-AvatarStack--disableExpand { | ||
| position: relative; | ||
| } | ||
| ${sx}; | ||
| `, | ||
| ) | ||
|
|
||
| const transformChildren = (children: React.ReactNode, enabled: boolean) => { |
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.
wow! 😍
|
Womp, looks like this passed golden jobs but not some other tests, can you take a look? @jonrohan https://github.com/github/github/pull/371265 👀 |
|
🟢 golden-jobs completed with status |
Changelog
New
Changed
Removed
Remove the CSS modules feature flag from the AvatarStack component
Rollout strategy
Testing & Reviewing
This shouldn't have any visual effect in production, the only thing to watch for is integration testing with the CI
Merge checklist