mediawiki-skins-Citizen/resources/skins.citizen.search/skins.citizen.search.less
alistair3149 9bf737f720
feat(search): add empty state to typeahead
This is a barebone initial implementation, more work will come to it
2022-12-06 12:01:47 -05:00

202 lines
3.4 KiB
Plaintext

@import '../variables.less';
@import '../mixins.less';
.citizen-typeahead {
position: absolute;
overflow: auto;
width: 100%;
max-height: var( --header-card-maxheight );
box-sizing: border-box;
padding: 0.75rem 0 0 0;
margin: -0.75rem 0 0 0; // Reset <ol> styles
//border-radius: 0 0 var( --border-radius--medium ) var( --border-radius--medium );
.citizen-card;
.citizen-card-hide( 50% 0, Y, false );
// Well this won't be loaded before .citizen-animation-ready anyways
.citizen-card-transition();
&__placeholder {
.citizen-typeahead {
&__content {
flex-direction: column;
padding: var( --space-xl ) 0;
text-align: center;
}
&__thumbnail {
margin-bottom: var( --space-sm );
img,
source {
object-fit: contain;
}
}
}
}
&__item {
&--active {
background-color: var( --background-color-primary--hover );
}
.citizen-typeahead {
&__thumbnail {
margin-right: var( --space-sm );
background-color: #eaecf0;
img,
source {
object-fit: cover;
}
}
}
}
&__content {
display: flex;
align-items: center;
padding: var( --space-xs ) 0;
margin: 0 var( --space-sm );
color: var( --color-base );
}
&__thumbnail {
overflow: hidden;
width: 100%;
max-width: 70px;
height: 60px;
border-radius: var( --border-radius--medium );
img,
source {
width: inherit;
height: inherit;
}
}
&__text {
overflow: hidden;
flex-grow: 1;
white-space: nowrap;
}
&__header {
display: flex;
justify-content: space-between;
}
&__title {
flex-shrink: 0;
color: var( --color-base--emphasized );
font-weight: var( --font-weight-semibold );
}
&__highlight {
color: var( --color-base--subtle );
font-weight: var( --font-weight-medium );
}
&__label {
display: flex;
margin-left: var( --space-xs );
color: var( --color-base );
font-size: 0.8125rem;
gap: var( --space-xxs );
.citizen-ui-icon {
width: 0.8125rem;
height: 0.8125rem;
margin-right: var( --space-xxs );
}
}
&__labelItem {
display: flex;
align-items: center;
}
&__description {
margin-top: 0.1rem;
color: var( --color-base--subtle );
font-size: 0.8125rem;
}
&__title,
&__description {
overflow: hidden;
text-overflow: ellipsis;
}
&__actions {
position: absolute;
right: var( --space-sm );
}
&__keyboard {
display: none;
padding: 0 8px;
border-radius: var( --border-radius--small );
background-color: var( --color-surface-1 );
}
&--expanded {
.citizen-card-show( false );
}
&--hasQuery {
.citizen-typeahead {
&__placeholder {
display: none;
}
}
#citizen-typeahead-fulltext {
display: block;
}
}
}
#citizen-typeahead-fulltext {
display: none;
.citizen-typeahead {
&__content {
padding: var( --space-md ) 0;
border-top: 1px solid var( --border-color-base );
}
&__thumbnail {
width: 70px; // Sync with thumbnail
height: var( --size-icon );
background-color: transparent;
img {
object-fit: contain;
}
}
&__description {
strong {
color: var( --color-base--emphasized );
}
}
}
}
// HACK: This is as close as we can to detect whether there is a keyboard in CSS
@media ( hover: hover ) and ( pointer: fine ) {
.citizen-typeahead {
&__item--active {
.citizen-typeahead__keyboard {
display: block;
}
}
}
}
// HACK: Hide default MW search suggestion if it somehow loaded
// This should be removed when we switch to vue search
.suggestions {
display: none !important;
}