mediawiki-skins-Citizen/resources/components/search.less

260 lines
6 KiB
Plaintext
Raw Normal View History

2019-08-15 17:40:13 +00:00
//
// Citizen - Search Styles
// https://starcitizen.tools
//
2019-12-12 17:52:52 +00:00
@suggestion-max-width: 400px + @icon-box-size + @icon-padding * 2; // 454px
2019-08-15 17:40:13 +00:00
// TODO: Make it configurable and flexible
#site-search {
2019-12-11 20:29:15 +00:00
#search-form {
2019-08-15 17:40:13 +00:00
position: absolute;
2019-12-11 20:29:15 +00:00
z-index: -1; // Not interactable
margin: 7px 0 8px; // 1px h3 screen reader
2019-12-16 19:52:04 +00:00
display: flex;
2019-12-11 20:29:15 +00:00
top: 0;
right: @icon-box-size + @icon-padding * 2;
2019-08-15 17:40:13 +00:00
opacity: 0;
2019-12-11 20:29:15 +00:00
.boxshadow(4);
transition: @transition-opacity;
2019-08-15 17:40:13 +00:00
2019-12-11 20:29:15 +00:00
// Search field
#search-input {
2019-12-12 02:28:45 +00:00
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
2019-12-11 20:29:15 +00:00
padding: 12px 15px;
width: 0;
max-width: calc(~"100vw -"@icon-box-size * 2 + @icon-padding * 4 + @margin-side );
border: 1px solid @base-90;
transition: @transition-width, @transition-box-shadow;
&:focus {
outline: 0;
.boxshadow(5);
}
2019-08-15 17:40:13 +00:00
}
2019-12-11 20:29:15 +00:00
// Search field button
2019-12-11 21:06:51 +00:00
#search-button {
2019-12-11 20:29:15 +00:00
.button-blue;
width: @icon-box-size + @icon-padding * 2;
2019-12-13 22:40:40 +00:00
height: 42px;
2019-12-11 20:29:15 +00:00
border: 0;
cursor: pointer; //somehow it is not pointer
2019-12-16 19:36:18 +00:00
img {
filter: invert(1);
width: 16px;
}
2019-12-11 20:29:15 +00:00
&:hover,
&:active,
&:focus {
.button-blue-active;
}
2019-08-15 17:40:13 +00:00
}
2019-12-11 20:29:15 +00:00
}
2019-08-15 17:40:13 +00:00
2019-12-11 20:40:59 +00:00
#search-toggle-icon-container {
2019-12-11 20:29:15 +00:00
display: flex;
align-items: center;
justify-content: center;
height: inherit;
2019-12-11 20:40:59 +00:00
#search-toggle-icon {
2019-12-11 20:29:15 +00:00
opacity: @opacity-icon;
position: absolute;
margin-top: -2px;
margin-left: -2px;
width: 10px;
height: 10px;
border: solid 2px @base-0;
border-radius: 100%;
transform: rotate(-45deg);
transition: @transition-transform,
@transition-height,
@transition-opacity,
@transition-border-color;
&:before,
&:after {
content: '';
position: absolute;
width: 2px;
background-color: @base-0;
transition: inherit;
}
2019-08-15 17:40:13 +00:00
2019-12-11 20:29:15 +00:00
&:before {
top: 10px;
left: 3px;
height: 10px;
}
2019-08-15 17:40:13 +00:00
&:after {
2019-12-11 20:29:15 +00:00
opacity: 0;
top: -1px;
left: 4px;
height: 18px;
transform: rotate(-90deg);
2019-08-15 17:40:13 +00:00
}
}
2019-12-11 20:29:15 +00:00
}
2019-08-15 17:40:13 +00:00
2019-12-11 20:40:59 +00:00
#search-toggle {
2019-12-11 20:29:15 +00:00
&:checked {
~#search-form {
z-index: 5;
opacity: 1;
#search-input {
2019-12-11 20:29:15 +00:00
width: 400px;
}
}
2019-08-15 17:40:13 +00:00
2019-12-11 20:40:59 +00:00
~#search-toggle-icon-container #search-toggle-icon {
2019-12-11 20:29:15 +00:00
border-color: transparent;
&:before {
height: 18px;
transform: translate(1px, -11px);
}
&:after {
opacity: 1;
}
&:hover {
2019-12-11 20:40:59 +00:00
~#search-toggle-icon-container #search-toggle-icon {
2019-12-11 20:29:15 +00:00
border-color: @base-0;
&:after {
opacity: 0;
}
}
}
}
&:hover {
2019-12-11 20:40:59 +00:00
~#search-toggle-icon-container #search-toggle-icon {
2019-12-11 20:29:15 +00:00
border-color: @base-0;
&:after {
height: 12px;
}
}
}
2019-08-15 17:40:13 +00:00
}
2019-12-11 20:29:15 +00:00
&:hover {
2019-12-11 20:40:59 +00:00
~#search-toggle-icon-container #search-toggle-icon {
2019-12-11 20:29:15 +00:00
opacity: @opacity-icon-active;
2019-08-15 17:40:13 +00:00
2019-12-11 20:29:15 +00:00
&:before {
height: 5px;
transform: translate(0px, 5px);
}
}
2019-08-15 17:40:13 +00:00
}
}
}
2019-12-12 00:35:49 +00:00
#typeahead-suggestions {
2019-12-16 20:03:57 +00:00
position: absolute;
top: @header-height
2019-12-12 00:35:49 +00:00
z-index: 99999;
}
2019-12-11 23:56:07 +00:00
.suggestions-dropdown {
background: @base-100;
2019-12-11 20:29:15 +00:00
.boxshadow(4);
2019-12-12 17:52:52 +00:00
width: @suggestion-max-width;
2019-12-12 02:00:39 +00:00
max-width: calc(~"100vw -"@icon-box-size + @icon-padding * 2 + @margin-side );
2019-12-12 00:22:50 +00:00
}
2019-12-12 00:13:20 +00:00
2019-12-12 00:22:50 +00:00
.suggestion-link {
display: block;
position: relative;
min-height: 2rem * @content-scaling;
padding: 1rem 1rem 1rem 8.5rem * @content-scaling;
2019-12-12 02:43:52 +00:00
border-bottom: 1px solid @base-90;
2019-12-12 00:22:50 +00:00
}
2019-12-12 00:13:20 +00:00
2019-12-12 00:22:50 +00:00
.suggestion-title {
margin: 0 0 0.78rem * @content-scaling 0;
2019-12-12 00:38:22 +00:00
color: @base-10;
2019-12-12 00:22:50 +00:00
font-size: 1.6rem * @content-scaling;
2019-12-12 00:38:22 +00:00
font-weight: 400;
2019-12-12 00:22:50 +00:00
line-height: 1.872rem * @content-scaling;
}
.suggestion-link.active .suggestion-title {
color: @accent-50;
}
.suggestion-highlight {
2019-12-12 00:38:22 +00:00
font-weight: 600;
font-style: normal;
2019-12-12 00:22:50 +00:00
}
.suggestion-description {
color: @base-30;
margin: 0;
2019-12-12 00:34:14 +00:00
font-family: @fonts;
2019-12-12 00:22:50 +00:00
font-size: 1.3rem * @content-scaling;
line-height: 1.43rem * @content-scaling;
}
.suggestion-link.active {
background-color: @accent-90;
}
/* using element selector to override default anchor styles */
a.suggestion-link:hover {
text-decoration: none;
}
.suggestion-thumbnail {
2019-12-12 00:34:14 +00:00
background-color: @base-80;
2019-12-12 00:22:50 +00:00
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
height: 100%;
width: 7rem * @content-scaling;
position: absolute;
top: 0;
left: 0;
2019-08-15 17:40:13 +00:00
}
// RTL tweaks
.rtl {
2019-12-11 20:29:15 +00:00
#site-search {
#search-form {
left: @icon-box-size + @margin-side + @icon-padding;
right: unset;
}
2019-08-15 17:40:13 +00:00
}
2019-12-12 17:44:36 +00:00
}
2019-12-12 17:52:52 +00:00
@media only screen and (max-width: @suggestion-max-width) {
2019-12-12 17:44:36 +00:00
.suggestions-dropdown {
position: fixed;
left: 0;
top: @header-height + 1px;
max-width: 100vw;
2019-12-12 18:37:26 +00:00
&:after {
content: "";
width: 100vw;
height: 100vh;
background: black;
display: block;
opacity: 0.7;
position: fixed;
}
2019-12-12 17:44:36 +00:00
}
2019-12-11 20:29:15 +00:00
}