mediawiki-skins-Citizen/resources/skins.citizen.styles.search/skins.citizen.styles.search.less
2021-03-09 13:13:49 -05:00

208 lines
4.6 KiB
Plaintext

//
// Citizen - Search styles
// https://starcitizen.tools
//
@import '../variables.less';
@import '../mixins.less';
#typeahead-suggestions {
position: absolute;
z-index: 90;
top: 38px;
}
.suggestions-dropdown {
display: flex; // Needed to show margin
width: @search-bar-width;
max-width: calc( ~'100vw -'@icon-box-size + @icon-padding * 2 + @margin-side );
flex-direction: column;
padding-top: 4px;
background: var( --background-color-dp-08 );
border-radius: 0 0 @border-radius-large @border-radius-large;
.boxshadow(4);
}
.suggestion {
&-link {
display: flex;
align-items: center;
padding: 8px 20px;
&.active {
background-color: var( --background-color-primary--hover );
&:active {
background-color: var( --background-color-primary--active );
}
}
}
&-text {
margin-left: 15px;
}
&-title {
display: inline-block; // so that the margin does not occupy space
margin: 0 0 0.78rem * @content-scaling 0;
color: var( --color-base );
font-size: @content-h6-size;
line-height: 1.872rem * @content-scaling;
}
&-highlight {
color: var( --color-base--subtle );
font-style: normal;
}
&-description {
margin: 0;
color: var( --color-base--subtle );
font-family: var( --font-family-base );
font-size: @content-caption-size;
line-height: 1.43rem * @content-scaling;
}
&-thumbnail {
width: 70px;
min-width: 70px; // so it won't be squeezed by the content text
height: 60px;
background-color: var( --background-color-framed );
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
border-radius: @border-radius-small;
}
}
#suggestion {
&-link {
&-first {
margin-top: 8px;
}
&-last {
margin-bottom: 8px;
}
}
&-special {
display: flex;
align-items: center;
padding: 1rem;
border-top: 1px solid var( --border-color-base );
border-radius: 0 0 @border-radius-large @border-radius-large;
color: var( --color-base );
&-icon {
width: 20px;
min-width: 20px;
height: 20px;
margin: 0 14px 0 10px;
background-repeat: no-repeat;
}
&-text {
overflow: hidden;
padding: 5px 0; // make it looks more center aligned
font-family: var( --font-family-base );
font-size: @content-caption-size;
font-weight: bold;
text-overflow: ellipsis; // handle overflow
}
&:hover {
background-color: var( --background-color-primary );
}
}
}
/* using element selector to override default anchor styles */
a.suggestion-link:hover {
text-decoration: none;
}
// RTL tweaks
.rtl {
#searchform {
right: unset;
left: @icon-box-size + @margin-side + @icon-padding;
}
}
/**
* Loading indicator for search widget
* Based on Vector
*
* By adding a class on the parent search form
* <div id="searchform" class="search-form__loader"></div>
* A pseudo element is added via ':after' that adds the loading indicator.
*
* After appearing for more than a second, a progress-bar animation appears
* above the loading indicator.
*
**/
#searchform.search-form__loading:after {
position: absolute;
z-index: 999;
top: 100%;
// Position loader below the input.
display: block;
overflow: hidden;
width: 100%;
// Hide text in case it extends beyond the input.
height: @search-loader-progress-bar-height;
// Ensure it doesn't extend beyond the input.
box-sizing: border-box;
// Overlay the form
margin-top: -@search-loader-progress-bar-height;
// Animates the progress-bar.
animation: search-loader-progress-bar
/* duration */ 1200ms
/* timing function */ linear
/* delay */ 1000ms
/* iteration count */ infinite
/* fill direction */ alternate;
// Add a progress-bar to the loading indicator,
// but only show it animating after 1 second of loading.
background: /*image*/ linear-gradient( 90deg, var( --color-primary ) 0%, var( --color-primary ) 100% )
/* position / size*/ -10% 0 ~'/' 0 @search-loader-progress-bar-height
/* repeat */ no-repeat,transparent;
// Align style with the form
border-radius: 0 0 @border-radius-large @border-radius-large;
// Placeholder text
content: 'loading';
text-overflow: ellipsis;
white-space: nowrap;
}
@keyframes search-loader-progress-bar {
0% {
background-position: -10% 0;
background-size: 0 @search-loader-progress-bar-height;
}
30% {
background-position: -10% 0;
background-size: 30% @search-loader-progress-bar-height;
}
70% {
background-position: 110% 0;
background-size: 30% @search-loader-progress-bar-height;
}
100% {
background-position: 110% 0;
background-size: 0 @search-loader-progress-bar-height;
}
}
@media only screen and ( max-width: @search-bar-width ) {
.suggestions-dropdown {
position: fixed;
left: 0;
max-width: 100vw;
}
}