zulip/web/styles/reactions.css

306 lines
8.8 KiB
CSS
Raw Normal View History

.message_reactions {
overflow: hidden;
user-select: none;
&:has(.message_reaction) {
margin-bottom: var(--message-box-markdown-aligned-vertical-space);
}
.message_reaction {
display: flex;
/* Set a pixel and half padding to maintain
pill height adjacent own reactions. */
padding: 1.5px 4px 1.5px 3px;
box-sizing: border-box;
min-width: 44px;
cursor: pointer;
color: var(--color-message-reaction-text);
background-color: var(--color-message-reaction-background);
border: 1px solid var(--color-message-reaction-border);
border-radius: 21px;
align-items: center;
box-shadow: inset 0 0 5px 0 var(--color-message-reaction-shadow-inner);
transition:
transform 100ms linear,
font-weight 100ms linear;
&.reacted {
color: var(--color-message-reaction-text-reacted);
background-color: var(--color-message-reaction-background-reacted);
border-color: var(--color-message-reaction-border-reacted);
/* Make this border thicker by half a pixel,
to make own reactions more prominent. */
border-width: 1.5px;
/* Reduce the padding top and bottom by half
a pixel accordingly, to maintain the same
pill height. */
padding: 1px 4px 1px 3px;
font-weight: var(--font-weight-message-reaction);
box-shadow: none;
}
&:hover {
background-color: var(--color-message-reaction-background-hover);
}
&:active {
transform: scale(var(--scale-message-reaction-active));
}
.emoji {
margin: 1px 3px;
/* 17px at 14px/1em */
height: 1.2143em;
width: 1.2143em;
/* Preserve the emoji's dimensions, no
matter what the flexbox does. */
flex-shrink: 0;
/* Don't inherit position: relative; from
the base .emoji class. */
position: static;
}
.emoji_alt_code {
/* Apply the same margins as on graphical emoji. */
margin: 1px 3px;
/* Reset some properties from the base .emoji_alt_code
class that aren't appropriate in a flexbox context. */
position: static;
/* Flexbox will handle baselines, so don't mess with the
line-height. */
line-height: inherit;
}
}
.message_reaction_count {
/* 90% works out here to 12.6px */
font-size: 90%;
/* No top and bottom margin; just allow
flexbox to handle the vertical alignment. */
margin: 0 3px;
/* Set the 12.6px text on a 13px line;
the goal is to have that 13px line
center correctly on the vertical with
the 17px-square emoji, resulting in
2px of space above and below the
reaction count/name. */
line-height: 13px;
}
.message_reaction:hover .message_reaction_count {
color: var(--color-message-reaction-button-text-hover);
}
&:hover .reaction_button {
visibility: visible;
pointer-events: all;
}
.emoji-message-control-button-container {
display: flex;
align-items: center;
}
.reaction_button {
visibility: hidden;
pointer-events: none;
/* Set top/bottom padding to accommodate borders
and padding around reaction pills. */
padding: 4px 6px;
border-radius: 21px;
color: var(--color-message-reaction-button-text);
background-color: var(--color-message-reaction-button-background);
border: 1px solid var(--color-message-reaction-button-border);
& i {
font-size: 1em;
color: var(--color-message-reaction-button-text);
}
&:hover i {
color: var(--color-message-reaction-button-text-hover);
}
&:hover {
color: var(--color-message-reaction-button-text-hover);
background-color: var(
--color-message-reaction-button-background-hover
);
border: 1px solid var(--color-message-reaction-button-border-hover);
border-color: var(--color-message-reaction-button-border-hover);
box-shadow: inset 0 0 5px 0
var(--color-message-reaction-shadow-inner);
cursor: pointer;
opacity: 1;
}
.message_reaction_count {
font-weight: 700;
color: var(--color-message-reaction-button-text);
margin-right: 0;
line-height: 14px;
}
&:hover .message_reaction_count {
color: var(--color-message-reaction-button-text-hover);
}
}
}
.active-emoji-picker-reference,
.active-playground-links-reference {
visibility: visible !important;
pointer-events: all !important;
opacity: 1 !important;
}
.emoji-picker-popover {
padding: 0;
height: 370px;
user-select: none;
.emoji-popover {
width: 250px;
Add frontend support for emoji reactions. This commit replaces the placeholder "clipboard" button with a reaction button. This is done on any message that can't be edited. Also, on messages sent by the user the actions popover (toggled by the down chevron icon) contains an option to add a reaction. When clicked, a popover with a search bar and a list of emojis is displayed. If the right sidebar is collapsed (the viewport is small), the popover is placed to the left of the button. Focus is set to the search bar. Typing in the search bar filters emojis. Emojis with which the user has reacted to this message are highlighted. Clicking them sends an API request to remove that reaction. Clicking on non-highlighted emojis sends an API request to add a reaction. When the popover loses focus it is closed. The frontend listens for reaction events. When an add-reaction event is received, the emoji is displayed at the bottom of the message with a count initialized to 1. If there was an existing reaction to the message with the same emoji, the count is incremented. Old messages fetched from the server contain reactions. They are displayed (along with title and count) at the bottom of each message. When clicking the emoji reaction at the bottom of the message, if the user has already reacted with that emoji to this message, the reaction is removed and the count is decremented. Otherwise, a reaction is added and the count is incremented. Hovering over the emoji reaction at the bottom of the message displays a list of users who have reacted with this emoji along with the emoji name. Hovering over the emoji reactions at the bottom of the message displays a button to add a reaction. Fixes #541.
2016-12-02 13:23:23 +01:00
.emoji-popover-category-tabs {
/* Flex needed here to work around #7511 (90% zoom issues in firefox) */
display: flex;
background-color: var(--color-background-emoji-picker-popover);
width: 100%;
box-sizing: border-box;
overflow: hidden;
.emoji-popover-tab-item {
display: inline-block;
padding-top: 8px;
width: 25px;
height: 25px;
text-align: center;
font-size: 16px;
cursor: pointer;
/* Flex needed here to work around #7511 (90% zoom issues in firefox) */
flex-grow: 1;
&.active {
background-color: var(
--color-background-emoji-picker-popover-tab-item-active
);
}
}
}
.emoji-popover-emoji-map,
.emoji-search-results-container {
padding: 0;
position: relative;
overflow: hidden auto;
display: block;
width: 247px;
padding-left: 3px;
}
.emoji-popover-emoji-map {
height: 250px;
.emoji-popover-subheading {
font-weight: 600;
padding: 5px 3px;
}
}
Add frontend support for emoji reactions. This commit replaces the placeholder "clipboard" button with a reaction button. This is done on any message that can't be edited. Also, on messages sent by the user the actions popover (toggled by the down chevron icon) contains an option to add a reaction. When clicked, a popover with a search bar and a list of emojis is displayed. If the right sidebar is collapsed (the viewport is small), the popover is placed to the left of the button. Focus is set to the search bar. Typing in the search bar filters emojis. Emojis with which the user has reacted to this message are highlighted. Clicking them sends an API request to remove that reaction. Clicking on non-highlighted emojis sends an API request to add a reaction. When the popover loses focus it is closed. The frontend listens for reaction events. When an add-reaction event is received, the emoji is displayed at the bottom of the message with a count initialized to 1. If there was an existing reaction to the message with the same emoji, the count is incremented. Old messages fetched from the server contain reactions. They are displayed (along with title and count) at the bottom of each message. When clicking the emoji reaction at the bottom of the message, if the user has already reacted with that emoji to this message, the reaction is removed and the count is decremented. Otherwise, a reaction is added and the count is incremented. Hovering over the emoji reaction at the bottom of the message displays a list of users who have reacted with this emoji along with the emoji name. Hovering over the emoji reactions at the bottom of the message displays a button to add a reaction. Fixes #541.
2016-12-02 13:23:23 +01:00
.emoji-popover-emoji {
display: inline-block;
margin: 0;
padding: 6px;
cursor: pointer;
border-radius: 0.5em;
height: 25px;
width: 25px;
&:focus {
background-color: var(
--color-background-emoji-picker-emoji-focus
);
/* Only dark mode takes a box shadow on
the emoji-picker's focused emoji. */
box-shadow: 0 0 1px
var(--color-box-shadow-emoji-picker-emoji-focus);
outline: none;
}
&.reacted {
background-color: var(
--color-background-emoji-picker-emoji-reacted
);
border-color: var(--color-border-emoji-picker-emoji-reacted);
}
&.reacted:focus {
background-color: var(
--color-background-emoji-picker-emoji-reacted-focus
);
}
&.hide {
display: none;
}
.emoji {
top: 6px;
}
}
.emoji-search-results-container {
height: 283px;
.emoji-popover-results-heading {
font-weight: 600;
padding: 5px 3px 3px 5px;
font-size: 17px;
}
}
}
.emoji-showcase-container {
position: relative;
background-color: var(--color-background-emoji-picker-popover);
min-height: 44px;
width: 250px;
border-radius: 0 0 3px 3px;
.emoji-preview {
position: absolute;
width: 32px;
height: 32px;
left: 5px;
top: 6px;
margin-top: 0;
}
.emoji-canonical-name {
position: relative;
top: 12px;
margin-left: 50px;
font-size: 16px;
font-weight: 600;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
}
.emoji_alt_code {
position: relative;
top: 4px;
font-size: 0.8em;
display: inline-block;
vertical-align: top;
margin: 0 1px 0 0;
line-height: 1em;
}
.typeahead .emoji {
top: 2px;
}