mediawiki-skins-Citizen/resources/skins.citizen.styles/Searchbox.less
alistair3149 c23a1d7838
feat: unify modal styles
All modals should follow the same styles
2022-04-28 15:18:41 -04:00

284 lines
5.4 KiB
Plaintext

#search {
&-checkbox {
&:checked {
~ #searchform {
z-index: 10;
pointer-events: auto; // clickable
transform: none;
}
~ #search-toggle-icon {
#search-toggle-icon {
&-2 {
border-color: transparent;
}
&-1 {
height: 16px;
transform: translate3d( -5px, -5px, 0 ) rotate( 135deg );
}
&-3 {
opacity: 1;
}
}
&:hover {
border-color: @base-0;
#search-toggle-icon-3 {
opacity: 0;
}
}
}
&:hover {
~ #search-toggle-icon {
#search-toggle-icon {
&-1 {
height: 12px;
transform: translate3d( -5px, -5px, 0 ) rotate( 135deg );
}
&-2 {
border-color: transparent;
}
&-3 {
height: 12px;
}
&-1,
&-3 {
background-color: var( --background-color-icon--hover );
}
}
}
}
&:active {
~ #search-toggle-icon {
#search-toggle-icon {
&-1,
&-3 {
background-color: var( --background-color-icon--active );
}
}
}
}
}
}
&form {
--width-search-bar: @width-search-bar;
--height-search-bar: @height-search-bar;
position: absolute;
z-index: -1; // not interactable
top: 0;
right: @margin-side / 2;
display: flex;
margin: var( --margin-header-item ) 0; // 1px h3 screen reader
border-radius: var( --border-radius--medium );
box-shadow: var( --box-shadow-dialog );
pointer-events: none; // not clickable
transform: translateX( 120% );
transition: @transition-transform-quick;
&-icon {
position: absolute;
z-index: 110;
width: var( --height-search-bar );
height: var( --height-search-bar );
background-position: center;
background-repeat: no-repeat;
background-size: 14px;
opacity: var( --opacity-icon-base );
}
&-random {
position: absolute;
z-index: 120;
right: 38px;
width: var( --height-search-bar );
height: var( --height-search-bar );
background-position: center;
background-repeat: no-repeat;
background-size: 18px;
opacity: var( --opacity-icon-base );
transition: @transition-transform-quick, @transition-opacity-quick;
&:hover {
opacity: var( --opacity-icon-base--hover );
transform: rotate( 30deg );
}
&:active {
opacity: var( --opacity-icon-base--active );
}
}
}
&-toggle {
position: absolute;
z-index: 21; // override to be on top of the form
right: 0; // align checkbox with icon
margin-right: var( --margin-header-item--corner );
margin-left: var( --margin-header-item--corner );
&-icon {
position: relative;
z-index: 20; // stay on top of search form
display: flex;
width: var( --width-button-base );
height: var( --height-header );
align-items: center;
justify-content: center;
margin-right: 10px;
transition: @transition-transform-quick, @transition-height-quick, @transition-opacity-quick, @transition-border-color-quick;
&-1 {
top: 6px;
/* @noflip */
left: 12px;
height: 8px;
transform: rotate( -45deg );
}
&-2 {
width: 10px;
height: 10px;
/* Use background-color variable because it is a part of the logo */
border: solid 2px var( --background-color-icon );
margin-top: -4px;
/* @noflip */
margin-left: -2px;
border-radius: 100%;
transform: rotate( -45deg );
}
&-3 {
top: 1px;
left: -7px;
height: 16px;
opacity: 0;
transform: rotate( -135deg );
}
&-1,
&-3 {
width: 2px;
background-color: var( --background-color-icon );
}
}
&:hover {
~ #search-toggle-icon {
#search-toggle-icon {
&-1 {
height: 6px;
background-color: var( --background-color-icon--hover );
transform: translate3d( 2px, 2px, 0 ) rotate( -45deg );
}
&-2 {
border-color: var( --background-color-icon--hover );
}
}
}
}
&:active {
~ #search-toggle-icon {
#search-toggle-icon {
&-1 {
background-color: var( --background-color-icon--active );
}
&-2 {
border-color: var( --background-color-icon--active );
}
}
}
}
}
&Input {
z-index: 100;
width: var( --width-search-bar );
max-width: ~'calc( 100vw - var( --padding-page ) )';
height: var( --height-search-bar );
padding: 8px ~'calc( var( --height-search-bar ) * 2 )' 8px var( --height-search-bar );
border-color: transparent; // Cancel default border
appearance: none;
border-radius: var( --border-radius--medium );
&:focus {
outline: 0;
// The search suggestion pop-up indicates for focus state
// border-color: var( --color-primary );
// box-shadow: inset 0 0 0 1px var( --color-primary );
}
}
}
.search {
&-toggle-icon-div {
position: relative;
border-radius: var( --border-radius--large );
transition: inherit;
}
}
/* @noflip */
.rtl {
#search-toggle-icon {
&-1 {
left: 2px;
}
&-2 {
margin-left: -4px;
}
}
}
.skin-citizen-dark {
#search {
&form {
&-icon,
&-random {
filter: invert( 1 );
}
}
}
}
@media ( max-width: @width-search-bar ) {
#search {
&form {
transition: none; // no transition on mobile
&:before {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: block;
background: rgba( 0, 0, 0, 0.7 );
content: '';
}
}
}
}
/**
* Loading indicator for searchbox
* See common/progressbar.less
**/
#searchform.citizen-loading:after {
position: absolute;
top: 100%;
}