mediawiki-skins-Citizen/resources/skins.citizen.styles/components/Search.less
alistair3149 739fa8504c
fix(core): 🐛 enter key should not clear search input
Use span instead of button element. As button element will make
enter key triggering the clear button.
2023-07-16 16:48:14 -04:00

130 lines
2.5 KiB
Plaintext

@width-search-bar: 560px;
.citizen-search {
--width-search-bar: @width-search-bar;
--height-search-bar: var( --header-button-size );
&__card {
position: fixed;
top: 0;
right: 0;
left: 0;
width: var( --width-search-bar );
max-width: ~'calc(100vw - var( --padding-page ) )';
height: var( --height-search-bar );
margin: var( --space-md ) auto;
.citizen-card();
.citizen-card-hide( top center, '', false );
.citizen-card-transition();
.citizen-ui-icon {
width: var( --height-search-bar );
height: var( --height-search-bar );
&::before {
background-size: 1rem;
}
}
}
&__formButton {
border-radius: var( --border-radius--small );
cursor: pointer;
.citizen-ui-icon::before {
transition: var( --transition-hover );
transition-property: opacity;
}
&:hover {
background-color: var( --background-color-quiet--hover );
.citizen-ui-icon::before {
opacity: var( --opacity-icon-base--hover );
}
}
&:active {
background-color: var( --background-color-quiet--active );
.citizen-ui-icon::before {
opacity: var( --opacity-icon-base--active );
}
}
}
&__clear {
.citizen-ui-icon::before {
background-size: 0.875rem; // Align with text size
}
}
&__random {
.citizen-ui-icon::before {
transition-property: opacity, transform;
}
&:hover {
.citizen-ui-icon::before {
transform: rotate( 30deg );
}
}
}
&__form {
display: flex;
/**
* Loading indicator for searchbox
* See common/progressbar.less
**/
&.citizen-loading::after {
position: absolute;
top: 100%;
}
}
#searchInput {
flex-grow: 1;
padding: 0;
border: 0; // Cancel default border
appearance: none;
background: transparent; // Cancel default background
font-size: 0.8125rem;
&: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 );
}
// Remove browser native clear all button in search field
&::-webkit-search-cancel-button {
-webkit-appearance: none;
}
}
}
// Checkbox hack
#citizen-search__checkbox:checked {
~ .citizen-search__card {
.citizen-card-show( false );
}
}
@media ( max-width: @width-breakpoint-desktop ) {
.citizen-search__card {
z-index: 1; // So that overlay does not cover card
width: auto;
margin: var( --space-xs );
// Remove searchbox open animation on mobile
// But keep suggestion animation
// So user can get to search instantly
.citizen-animations-ready & {
transition: none;
}
}
}