discourse/app/assets/stylesheets/common/base/search-menu.scss
Penar Musaraj 438a762956
FEATURE: Add assistant to quick search widget (#13650)
Replaces the autocomplete overlay for categories and usernames on the search input and adds suggestions as items in the search results instead. Also adds the same behaviour for @mentions as well as special `in: status: order:` keywords. See PR for more details.
2021-07-16 11:08:20 -04:00

311 lines
5.8 KiB
SCSS

.search-menu {
--search-padding: 0.5em;
.menu-panel .panel-body-contents {
overflow-y: auto;
}
.search-input {
position: relative;
padding: var(--search-padding);
}
.search-context {
label {
padding: 0.25em var(--search-padding);
}
.show-help {
margin-left: auto;
line-height: var(--line-height-medium);
}
}
.heading {
padding: 5px 0 5px 5px;
.filter {
padding: 0 5px;
}
}
input[type="text"] {
box-sizing: border-box;
width: 100%;
min-height: 32px;
margin-bottom: 0;
}
.search-context {
display: flex;
align-items: center;
label {
margin-bottom: 0;
}
}
.search-context + .results {
margin-top: 1em;
}
.results {
display: flex;
flex-direction: row;
.list {
min-width: 100px;
.item {
.blurb {
// https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
word-break: break-all;
word-break: break-word;
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
margin-top: 0.25em;
}
}
}
.search-result-topic {
.first-line {
display: block;
line-height: $line-height-medium;
}
.second-line {
display: flex;
flex-wrap: wrap;
align-items: center;
.discourse-tags {
.discourse-tag {
margin-right: 0.25em;
}
}
}
}
.search-result-post {
.blurb {
font-size: var(--font-down-1);
}
}
.main-results {
display: flex;
flex: 1 1 auto;
.topic-statuses {
color: var(--primary-medium);
}
}
.main-results + .secondary-results {
border-left: 1px solid var(--primary-low);
margin-left: 1em;
padding-left: 1em;
max-width: 33%;
}
.secondary-results {
display: flex;
flex-direction: column;
flex: 1 1 auto;
.separator {
margin: 1em 0.25em;
height: 1px;
background: var(--primary-low);
}
.search-result-tag {
.discourse-tag {
font-size: $font-down-1;
}
}
.search-result-category {
.widget-link {
margin-bottom: 0;
}
}
.search-result-group {
.search-link {
color: var(--primary-high);
&:hover {
color: var(--primary);
}
}
.group-result {
display: flex;
align-items: center;
.d-icon,
.avatar-flair {
min-width: 25px;
margin-right: 0.5em;
.d-icon {
margin-right: 0;
}
}
.avatar-flair-image {
background-repeat: no-repeat;
background-size: 100% 100%;
min-height: 25px;
}
.group-names {
display: flex;
flex-direction: column;
overflow: auto;
line-height: $line-height-medium;
&:hover {
.name,
.slug {
color: var(--primary-high);
}
}
.name,
.slug {
@include ellipsis;
}
.name {
font-weight: 700;
}
.slug {
font-size: $font-down-1;
color: var(--primary-high);
}
}
}
}
.search-result-category,
.search-result-user,
.search-result-group,
.search-result-tag {
.list {
display: block;
.item {
.widget-link.search-link {
flex: 1;
font-size: $font-0;
padding: 0.25em;
}
}
}
}
.search-result-user {
.user-result {
display: flex;
flex-direction: row;
align-items: center;
.avatar {
margin-right: 0.5em;
display: block;
min-width: 25px;
}
.user-titles {
display: flex;
flex-direction: column;
overflow: auto;
line-height: $line-height-medium;
.username,
.name {
@include ellipsis;
}
.username {
color: var(--primary-high-or-secondary-low);
font-size: $font-down-1;
}
.custom-field {
color: var(--primary-high-or-secondary-low);
font-size: $font-down-2;
}
.name {
color: var(--primary-high-or-secondary-low);
font-size: $font-0;
font-weight: 700;
}
}
}
}
}
.search-menu-assistant {
min-width: 100%;
margin-top: -1em;
.search-menu-assistant-item {
> span {
vertical-align: baseline;
display: inline-block;
}
}
.search-item-user .avatar,
.search-item-prefix {
margin-right: 0.5em;
}
}
}
.searching {
position: absolute;
top: 1.1em;
right: 1em;
.spinner {
width: 10px;
height: 10px;
border-width: 2px;
margin: 0;
}
}
.no-results {
padding: var(--search-padding);
}
.search-link {
padding: var(--search-padding);
.badge-category-parent {
line-height: $line-height-small;
}
.topic {
display: block;
}
.topic-title {
color: var(--tertiary);
overflow-wrap: anywhere;
@supports not (overflow-wrap: anywhere) {
word-break: break-word;
}
margin-right: 0.25em;
}
}
}