UX: Prevent badges on usercards from overflowing (#12037)

This commit is contained in:
Kris 2021-02-11 13:41:58 -05:00 committed by GitHub
parent 04d0bf9c4a
commit fcf674f106
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 5 deletions

View File

@ -2,7 +2,7 @@ import Component from "@ember/component";
import discourseComputed from "discourse-common/utils/decorators";
export default Component.extend({
tagName: "span",
tagName: "",
@discourseComputed("count")
showGrantCount(count) {

View File

@ -1,4 +1,4 @@
<a href={{this.badgeUrl}}>
<a class="user-card-badge-link" href={{this.badgeUrl}}>
{{#badge-button badge=@badge}}
{{#if this.showGrantCount}}
<span class="count">(&times;&nbsp;{{@count}})</span>

View File

@ -239,7 +239,11 @@ $avatar_margin: -50px; // negative margin makes avatars extend above cards
border: 1px solid var(--primary-low);
color: var(--primary);
}
.user-card-badge-link {
overflow: hidden;
}
.more-user-badges {
flex: 0 0 auto; // this is more important than other badges, so don't allow it to shrink
a {
@extend .user-badge;
}

View File

@ -55,14 +55,15 @@ $avatar_width: 120px;
// badges
.badge-section {
flex-wrap: wrap;
> span {
.user-card-badge-link,
.more-user-badges {
display: flex;
flex: 0 1 50%;
max-width: 50%; // for text ellipsis
padding: 2px 0;
box-sizing: border-box;
&:nth-of-type(1),
&:nth-of-type(3) {
&:nth-child(1),
&:nth-child(3) {
padding-right: 4px;
}
a {