mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-26 10:47:04 -06:00
Replace cropperjs, which was stuck on v1 because v2 was too complex to migrate to, with `@github/image-crop-element`, the cropper GitHub uses (2.3 KB vs 14.5 KB gzipped). A full selection of a square image uploads the original file so animated avatars keep working, any other selection uploads the selected square as PNG. Custom element events are now typed via `HTMLElementEventMap`, removing event casts. <img width="208" height="208" alt="Avatar crop panel with the Gitea logo" src="https://github.com/user-attachments/assets/dbdc2744-592a-45ea-91d2-356c34a0d52b"> Ref: https://github.com/go-gitea/gitea/pull/33827 Assisted-by: Claude Code:claude-opus-5-5
128 lines
3.1 KiB
CSS
128 lines
3.1 KiB
CSS
img.ui.avatar {
|
|
border-radius: var(--border-radius);
|
|
object-fit: contain;
|
|
aspect-ratio: 1;
|
|
}
|
|
|
|
.avatar-stack-names {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
align-self: center;
|
|
gap: 4px;
|
|
white-space: nowrap;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.avatar-stack-names > a.muted,
|
|
.avatar-stack-names > .avatar-stack-name,
|
|
.avatar-stack-names > .avatar-stack-popup-trigger {
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
max-width: 240px;
|
|
}
|
|
|
|
.avatar-stack-names > a,
|
|
.avatar-stack-names > .avatar-stack-popup-trigger {
|
|
font-weight: var(--font-weight-semibold);
|
|
}
|
|
|
|
/* template emits children reversed; row-reverse re-orders visually and keeps the author last-painted (on top) */
|
|
.avatar-stack {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
flex-direction: row-reverse;
|
|
}
|
|
|
|
.avatar-stack > * {
|
|
margin-left: -16px;
|
|
transition: transform 0.15s ease, opacity 0.15s ease;
|
|
position: relative;
|
|
display: inline-flex;
|
|
}
|
|
|
|
.avatar-stack > *:last-child { margin-left: 0; }
|
|
.avatar-stack > *:nth-last-child(2) { margin-left: -14px; }
|
|
|
|
/* hover spreads via transform (no layout shift); positions count from visual-left = last DOM child = :nth-last-child */
|
|
.avatar-stack:hover > *:nth-last-child(2) { transform: translateX(14px); }
|
|
.avatar-stack:hover > *:nth-last-child(3) { transform: translateX(30px); }
|
|
.avatar-stack:hover > *:nth-last-child(4) { transform: translateX(46px); }
|
|
.avatar-stack:hover > *:nth-last-child(5) { transform: translateX(62px); }
|
|
.avatar-stack:hover > *:nth-last-child(6) { transform: translateX(78px); }
|
|
.avatar-stack:hover > *:nth-last-child(7) { transform: translateX(94px); }
|
|
.avatar-stack:hover > *:nth-last-child(8) { transform: translateX(110px); }
|
|
.avatar-stack:hover > *:nth-last-child(9) { transform: translateX(126px); }
|
|
.avatar-stack:hover > *:nth-last-child(10) { transform: translateX(142px); }
|
|
.avatar-stack:hover > *:nth-last-child(11) { transform: translateX(158px); }
|
|
|
|
.avatar-stack .avatar {
|
|
border: 1px solid var(--color-body);
|
|
background: var(--color-body);
|
|
transition: border-color 0.15s ease, background-color 0.15s ease;
|
|
}
|
|
|
|
.avatar-stack:hover .avatar {
|
|
background-color: var(--color-body);
|
|
}
|
|
|
|
.avatar-stack-overflow-chip {
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 0;
|
|
height: 20px;
|
|
margin-left: 0;
|
|
border: 0 solid var(--color-body);
|
|
border-radius: var(--border-radius);
|
|
color: var(--color-text);
|
|
font-weight: var(--font-weight-semibold);
|
|
overflow: hidden;
|
|
opacity: 0;
|
|
transition: all 0.15s ease;
|
|
}
|
|
|
|
.avatar-stack:hover .avatar-stack-overflow-chip {
|
|
width: 20px;
|
|
margin-left: -16px;
|
|
border-width: 1px;
|
|
opacity: 1;
|
|
}
|
|
|
|
.avatar-stack-popup-trigger {
|
|
cursor: pointer;
|
|
background: none;
|
|
border: none;
|
|
padding: 0;
|
|
font: inherit;
|
|
color: inherit;
|
|
}
|
|
|
|
.avatar-stack-popup-trigger:hover {
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.avatar-stack-popup {
|
|
min-width: 200px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 4px 0;
|
|
}
|
|
|
|
.avatar-stack-popup > a {
|
|
padding: 6px 12px;
|
|
gap: 8px;
|
|
}
|
|
|
|
.avatar-stack-popup > a:hover {
|
|
background: var(--color-hover);
|
|
}
|
|
|
|
@media (max-width: 767.98px) {
|
|
.avatar-stack-names {
|
|
max-width: 80px;
|
|
}
|
|
}
|
|
|
|
.cropper-panel image-crop {
|
|
max-width: 400px;
|
|
}
|