discourse/app/assets/stylesheets/common/base/search-menu.scss
Isaac Janzen 742d71e99c
DEV: Finalize glimmer search menu (#23174)
There was a few outstanding items that needed cleaning up.
### Make sure we don't clear the topic context prematurely
##### Before
https://github.com/discourse/discourse/assets/50783505/e92e4d6f-f42c-4357-8f13-8fa9f1024ade

_getting to zero search characters would automatically clear the search context_

##### After
https://github.com/discourse/discourse/assets/50783505/fd805dfd-576d-4e32-b6b5-5b93c25a5782

### Style fixes
##### Before
<img width="498" alt="Screenshot 2023-08-21 at 4 37 31 PM" src="https://github.com/discourse/discourse/assets/50783505/70847db1-43ec-477e-a21a-54ef2de0af42">

##### After
<img width="500" alt="Screenshot 2023-08-21 at 4 38 36 PM" src="https://github.com/discourse/discourse/assets/50783505/98cfb2e9-7c4d-44a6-bde2-53b85318fed3">

##### Before
<img width="450" alt="Screenshot 2023-08-21 at 4 33 45 PM" src="https://github.com/discourse/discourse/assets/50783505/3e057a52-5d1c-4776-93d0-a48133a722bc">

##### After
<img width="451" alt="Screenshot 2023-08-21 at 4 34 30 PM" src="https://github.com/discourse/discourse/assets/50783505/77548f6c-a9cf-4cf8-88d8-ee249736d684">

##### Before
<img width="460" alt="Screenshot 2023-08-21 at 4 31 01 PM" src="https://github.com/discourse/discourse/assets/50783505/9da57868-bc66-4d84-9108-4ae705a0562b">

##### After
<img width="456" alt="Screenshot 2023-08-21 at 4 30 52 PM" src="https://github.com/discourse/discourse/assets/50783505/f9444546-97f2-4d1a-9f78-7407f0f32ae7">
2023-08-21 17:51:11 -05:00

385 lines
7.4 KiB
SCSS

@mixin user-item-flex {
display: flex;
flex-direction: column;
line-height: var(--line-height-medium);
color: var(--primary-high-or-secondary-low);
}
@mixin separator {
border-top: 1px solid var(--primary-low);
margin-top: 0.5em;
padding-top: 0.5em;
}
$search-pad-vertical: 0.25em;
$search-pad-horizontal: 0.5em;
.search-menu {
.menu-panel .panel-body-contents {
overflow-y: auto;
}
.search-input {
position: relative;
margin: 1px;
display: flex;
align-items: center;
border: 1px solid var(--primary-medium);
input#search-term {
border-width: 0;
margin-bottom: 0;
width: auto;
flex-grow: 1;
padding-right: 50px;
&:focus {
outline: none;
}
}
.btn.search-context {
margin: 2px;
margin-right: 0;
white-space: nowrap;
}
&:focus-within {
@include default-focus;
}
}
.heading {
padding: 5px 0 5px 5px;
.filter {
padding: 0 5px;
}
}
input[type="text"] {
margin-right: 0px;
}
.results {
display: flex;
flex-direction: column;
padding-top: $search-pad-vertical;
padding-bottom: $search-pad-vertical;
.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;
word-break: break-all;
word-break: break-word;
-webkit-hyphens: auto;
hyphens: auto;
margin-top: 0.25em;
}
}
}
.search-result-topic {
.first-line {
display: block;
line-height: var(--line-height-medium);
}
.second-line {
display: flex;
flex-wrap: wrap;
align-items: baseline;
.badge-wrapper {
margin-right: 0.5em;
}
.discourse-tags .discourse-tag {
margin-right: 0.35em;
}
}
}
.search-result-post {
.blurb {
font-size: var(--font-down-1);
}
}
.search-result-category {
.widget-link {
margin-bottom: 0;
}
}
.search-result-group .group-result,
.search-result-user .user-result {
display: flex;
align-items: center;
font-size: var(--font-down-1);
}
.search-result-group .group-result {
.d-icon,
.avatar-flair {
width: 20px;
height: 20px;
}
.avatar-flair,
.d-icon-users {
margin-right: 0.5em;
}
.avatar-flair {
border-radius: 50%;
&.avatar-flair-image {
background-repeat: no-repeat;
background-size: 100% 100%;
}
.d-icon {
margin-right: 0;
}
}
.group-names {
@include user-item-flex;
.name,
.slug {
@include ellipsis;
}
.name {
font-weight: 700;
}
}
}
.search-result-user .user-result {
.user-titles {
@include user-item-flex;
.username,
.name {
@include ellipsis;
}
.name {
font-weight: 700;
}
.username,
.name,
.custom-field {
color: var(--primary-high-or-secondary-low);
}
.custom-field {
font-size: var(--font-down-2);
}
}
}
.search-result-category,
.search-result-tag {
+ .search-result-user,
+ .search-result-group {
@include separator;
}
}
.search-result-user .user-result img.avatar,
.search-item-user img.avatar {
width: 20px;
height: 20px;
margin-right: 0.5em;
}
.label-suffix {
color: var(--primary-medium);
margin-right: 0.33em;
}
.search-item-tag {
color: var(--primary-high);
}
.extra-hint {
color: var(--primary-low-mid);
font-size: var(--font-down-1);
}
.search-item-slug {
.keyword {
margin-right: 0.33em;
}
.badge-wrapper {
font-size: var(--font-0);
margin-left: 2px;
}
}
.search-menu-initial-options {
+ .search-result-tag,
+ .search-result-category,
+ .search-result-user,
+ .search-result-group {
@include separator;
}
}
.search-menu-initial-options,
.search-result-tag,
.search-menu-assistant {
.search-item-prefix {
margin-right: 0.33em;
}
.badge-wrapper {
font-size: var(--font-0);
margin-right: 0.5em;
}
.search-link {
display: flex;
flex-wrap: wrap;
align-items: baseline;
@include ellipsis;
.d-icon {
margin-right: 0.33em;
vertical-align: middle;
}
.d-icon-tag {
font-size: var(--font-down-2);
}
.d-icon-search {
font-size: var(--font-down-1);
}
}
}
}
.browser-search-tip,
.search-random-quick-tip {
padding: $search-pad-vertical 1px;
font-size: var(--font-down-2);
color: var(--primary-medium);
.tip-label {
background-color: rgba(var(--tertiary-rgb), 0.1);
margin-right: 4px;
padding: 2px 4px;
display: inline-block;
&.tip-clickable {
cursor: pointer;
}
}
}
.search-menu-recent {
@include separator;
.heading {
display: flex;
justify-content: space-between;
h4 {
color: var(--primary-medium);
font-weight: normal;
margin-bottom: 0;
}
.clear-recent-searches {
cursor: pointer;
color: var(--primary-low-mid);
}
}
}
.browser-search-tip {
padding-top: 0.5em;
}
.searching {
position: absolute;
top: $search-pad-vertical + 0.2em;
right: $search-pad-horizontal;
min-height: 20px;
.spinner {
width: 12px;
height: 12px;
border-width: 2px;
margin: 0;
margin-top: 2px;
}
a.show-advanced-search,
a.clear-search {
padding: 0px 3px;
display: inline-block;
background-color: transparent;
.d-icon {
color: var(--primary-low-mid);
}
&:hover .d-icon {
color: var(--primary-high);
}
}
a.clear-search {
margin-right: 3px;
}
}
.no-results {
padding: $search-pad-vertical $search-pad-horizontal;
}
.search-link {
display: block;
padding: $search-pad-vertical $search-pad-horizontal;
// This is purposefully redundant
// the search widget can be used outside of the header
// and the focus/hover styles from the header in those cases wouldn't follow
&:focus,
&:hover {
background-color: var(--highlight-bg);
}
.topic {
display: block;
}
.topic-title {
color: var(--tertiary);
overflow-wrap: anywhere;
@supports not (overflow-wrap: anywhere) {
word-break: break-word;
}
margin-right: 0.25em;
}
}
.search-result-topic,
.search-result-post {
.search-link {
padding: 0.5em;
}
}
}
// these styles will become the default once the glimmer search menu
// is enabled for all users, and the old search menu is removed
// we can then drop any '!important' rules
.search-menu.glimmer-search-menu {
.search-item-tag .d-icon {
margin-right: 0 !important;
}
.search-item-user {
.username {
margin-right: 0.33rem;
}
img.avatar {
margin-right: 0 !important;
}
}
}