mirror of
https://github.com/primer/css.git
synced 2024-12-20 12:42:07 +03:00
130 lines
2.3 KiB
SCSS
130 lines
2.3 KiB
SCSS
// Stacked avatars can be used to show who is participating in thread when
|
|
// there is limited space available.
|
|
//
|
|
// No styleguide references
|
|
.avatar-stack {
|
|
display: inline-block;
|
|
white-space: nowrap;
|
|
|
|
.avatar {
|
|
position: relative;
|
|
z-index: 2;
|
|
display: inline-block;
|
|
width: 20px;
|
|
height: 20px;
|
|
box-sizing: content-box;
|
|
margin-right: -15px;
|
|
background-color: $bg-white;
|
|
border-right: 1px solid $white;
|
|
border-radius: 2px;
|
|
transition: margin 0.1s ease-in-out;
|
|
|
|
&:only-child {
|
|
background-color: transparent;
|
|
}
|
|
|
|
&:first-child {
|
|
z-index: 3;
|
|
}
|
|
|
|
&:last-child {
|
|
z-index: 1;
|
|
margin-right: 0;
|
|
border-right: 0;
|
|
}
|
|
}
|
|
|
|
// When more than one avatar, margin-left will animate from -15 to 2, and reveal the stack
|
|
&:hover .avatar {
|
|
margin-right: 3px;
|
|
|
|
&:last-child {
|
|
margin-right: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Refactored, new avatar stack:
|
|
|
|
.AvatarStack {
|
|
background: inherit;
|
|
|
|
.avatar {
|
|
position: relative;
|
|
z-index: 2;
|
|
display: inline-block;
|
|
width: 20px;
|
|
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: 3px;
|
|
}
|
|
}
|
|
|
|
.avatar.avatar-more {
|
|
z-index: 1;
|
|
margin-right: 0;
|
|
background: $gray-100;
|
|
|
|
&::after {
|
|
display: block;
|
|
width: 17px;
|
|
height: 20px;
|
|
content: "";
|
|
background: $gray-200;
|
|
border-radius: 2px;
|
|
outline: $border-width $border-style $white;
|
|
}
|
|
}
|
|
|
|
.AvatarStack:hover .avatar-more {
|
|
display: none;
|
|
}
|
|
|
|
// Temp tooltip class to position it correctly
|
|
|
|
.temp-tooltipped-align-left {
|
|
&::after {
|
|
left: 0 !important;
|
|
margin-left: 0 !important;
|
|
}
|
|
|
|
&::before {
|
|
left: 5px !important;
|
|
}
|
|
}
|