Skip to content
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

Wrap reaction avatars to avoid "CSS IS AWESØME" #2904

Merged
merged 3 commits into from
Mar 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 10 additions & 15 deletions source/features/reactions-avatars.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
padding-right: 0.7em !important;
padding-left: 0.7em !important;
}
button.reaction-summary-item { /* `button` excludes the "Add reaction" icon */
border-top: 1px solid #e1e4e8; /* Required when the second line is longer than the first line */
border-bottom: 1px solid #e1e4e8; /* Required when the first line is longer than the second line */
margin-bottom: -1px; /* Makes up for `order-bottom` */
}
.comment-reactions .js-pick-reaction {
margin-top: -1px; /* Makes up for `.reaction-summary-item {border-top}` */
}

.reaction-summary-item.user-has-reacted {
--background: #f2f8fa;
}
Expand All @@ -11,12 +20,11 @@
height: 2em;
border-radius: 3px;
margin-top: -0.3em;
margin-left: -0.2em;
margin-left: -0.5em;
vertical-align: middle;
background: #efefef; /* Placeholder before the images load */
box-shadow: 0 0 0 2px var(--background, #fff);
font-size: 10px; /* Base sizer */
transition: margin-left 0.2s;
}
.reaction-summary-item a:first-of-type {
margin-left: 0.5em;
Expand All @@ -34,16 +42,3 @@
border-radius: inherit;
background-color: var(--background);
}

/* Overlap reaction avatars when there are 5+ types of reactions */
.rgh-reactions-near-limit .reaction-summary-item:not(:hover) a:not(:first-of-type) {
margin-left: -12px;
}
/* Avoid wrapping */
.has-reactions,
.rgh-reactions-near-limit {
display: flex;
}
.rgh-reactions-near-limit {
background: #fff;
}
5 changes: 0 additions & 5 deletions source/features/reactions-avatars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ function init(): void {

list.classList.add('rgh-reactions');

// Overlap reaction avatars when near the avatarLimit
if (flatParticipants.length > avatarLimit * 0.9) {
list.classList.add('rgh-reactions-near-limit');
}

onUpdatableContentUpdate(list.closest<HTMLElement>('.js-updatable-content')!, init);
}
}
Expand Down