zulip/static/styles/input_pill.css
Oliver Pham 2ed650f596 search_suggestion: Show profile pictures in autocomplete suggestions.
Because the typeahead.js list items are currently just text, a user's
full name and avatar should be displayed in `input_pill`. To use
`input_pill`, a separate Handlebars partial view was created to
provide a mandatory container (`<div class="pill-container">`) for
`input_pill` and a flex container (`<div class="search_list_item">`)
for vertically aligning the text.

The description of each suggestion (i.e `description_html`) is
rendered as raw HTML, so every special character (e.g. whitespace)
should be HTML-escaped. This enables highlighting the substring in
each search suggestion that matches the query.

Fixes: #20267
2022-08-16 14:17:42 -07:00

165 lines
3.1 KiB
CSS

.pill-container {
display: inline-flex;
flex-wrap: wrap;
padding: 2px;
border: 1px solid hsla(0, 0%, 0%, 0.15);
border-radius: 4px;
align-items: center;
cursor: text;
.pill {
display: inline-flex;
align-items: center;
height: 20px;
margin: 1px 2px;
color: inherit;
border: 1px solid hsla(0, 0%, 0%, 0.15);
border-radius: 4px;
background-color: hsla(0, 0%, 0%, 0.07);
cursor: pointer;
&:focus {
color: hsl(0, 0%, 100%);
border: 1px solid hsl(176, 78%, 28%);
background-color: hsl(176, 49%, 42%);
outline: none;
}
.pill-image {
height: 20px;
width: 20px;
border-radius: 4px 0 0 4px;
}
.pill-value {
margin: 0 5px;
}
.exit {
opacity: 0.5;
font-size: 1.3em;
margin-right: 3px;
}
&:hover .exit {
opacity: 1;
}
}
&.not-editable {
cursor: not-allowed;
border: none;
background-color: transparent;
padding: 0;
.pill {
padding-right: 4px;
cursor: not-allowed;
&:focus {
color: inherit;
border: 1px solid hsla(0, 0%, 0%, 0.15);
background-color: hsla(0, 0%, 0%, 0.07);
}
.exit {
display: none;
}
}
}
&.pill-container-btn {
cursor: pointer;
padding: 0;
.pill {
margin: 0;
border: none;
.exit {
display: none;
}
}
}
.input {
display: inline-block;
padding: 2px 4px;
min-width: 2px;
word-break: break-all;
outline: none;
&.shake {
animation: shake 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
transform: translate3d(0, 0, 0);
backface-visibility: hidden;
perspective: 1000px;
}
}
}
.pm_recipient .pill-container {
padding: 0 2px;
border: none;
flex-grow: 1;
align-content: center;
.input {
height: 20px;
&:first-child:empty::before {
content: attr(data-no-recipients-text);
opacity: 0.5;
}
}
.pill + .input:empty::before {
content: attr(data-some-recipients-text);
opacity: 0.5;
}
}
.deactivated-pill {
background-color: hsl(0, 86%, 86%) !important;
}
.add_subscribers_container .pill-container {
width: 100%;
background-color: hsl(0, 0%, 100%);
.input:first-child:empty::before {
opacity: 0.5;
content: attr(data-placeholder);
}
}
@keyframes shake {
10%,
90% {
transform: translate3d(-1px, 0, 0);
}
20%,
80% {
transform: translate3d(2px, 0, 0);
}
30%,
50%,
70% {
transform: translate3d(-3px, 0, 0);
}
40%,
60% {
transform: translate3d(3px, 0, 0);
}
}