1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-05 02:57:40 -05:00
notes/_sass/search.scss
2019-12-03 09:12:54 +01:00

242 lines
4.2 KiB
SCSS

//
// Search input and autocomplete
//
.search {
position: relative;
z-index: 2;
flex-grow: 1;
height: $sp-10;
padding-top: $sp-2;
padding-bottom: $sp-2;
@include mq(md) {
height: 100%;
max-width: $search-results-width;
padding-top: 0;
padding-bottom: 0;
}
}
.search-input-wrap {
position: relative;
height: 100%;
margin-right: $sp-2;
margin-left: $sp-2;
transition: margin linear 100ms;
@include mq(md) {
margin-right: 0;
margin-left: 0;
transition: none;
}
}
.search-input {
position: absolute;
width: 100%;
height: 100%;
padding-top: $sp-2;
padding-right: $gutter-spacing-sm;
padding-bottom: $sp-2;
padding-left: #{$gutter-spacing-sm + $sp-4 * 1.2 + $sp-2};
background-color: $search-background-color;
border-top: 0;
border-right: 0;
border-bottom: 0;
border-left: 0;
border-radius: $border-radius;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
transition: width ease 200ms;
@include fs-4;
@include mq(md) {
max-width: $search-results-width;
padding-left: #{$gutter-spacing + $sp-5};
background-color: $body-background-color;
border-radius: 0;
box-shadow: none;
@include fs-3;
}
&:focus {
outline: 0;
+ .search-label .search-icon {
fill: $link-color;
}
}
}
.search-label {
position: absolute;
display: flex;
height: 100%;
padding-left: $gutter-spacing-sm;
@include mq(md) {
padding-left: $gutter-spacing;
}
.search-icon {
width: #{$sp-4 * 1.2};
height: #{$sp-4 * 1.2};
align-self: center;
fill: $grey-dk-000;
}
}
.search-results {
position: absolute;
display: none;
width: 100%;
max-height: calc(100vh - 100%);
overflow-y: auto;
background: $search-background-color;
border-bottom-left-radius: $border-radius;
border-bottom-right-radius: $border-radius;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
@include mq(md) {
width: $search-results-width;
}
}
.search-results-list {
padding-left: 0;
margin-bottom: $sp-1;
list-style: none;
@include fs-4;
@include mq(md) {
@include fs-3;
}
}
.search-results-list-item {
padding: 0;
margin: 0;
}
.search-result {
display: block;
padding-top: $sp-1;
padding-right: $sp-3;
padding-bottom: $sp-1;
padding-left: $sp-3;
&:hover,
&.active {
background-color: $feedback-color;
}
@include mq(md) {
padding-right: $sp-4;
padding-left: $sp-4;
}
}
.search-result-title {
display: block;
padding-top: $sp-2;
padding-right: $sp-4;
padding-bottom: $sp-2;
@include mq(sm) {
display: inline-block;
width: 40%;
word-wrap: break-word;
vertical-align: top;
}
}
.search-result-rel-url {
display: block;
overflow: hidden;
color: $search-result-preview-color;
text-overflow: ellipsis;
white-space: nowrap;
@include fs-1;
}
.search-result-preview {
display: block;
padding-top: $sp-2;
padding-bottom: $sp-2;
padding-left: $sp-4;
color: $search-result-preview-color;
border-left: $border;
border-left-color: $border-color;
@include fs-2;
@include mq(sm) {
display: inline-block;
width: 60%;
vertical-align: top;
}
}
.search-result-highlight {
font-weight: bold;
color: $link-color;
}
.search-button {
position: fixed;
right: $sp-4;
bottom: $sp-4;
display: flex;
width: $sp-9;
height: $sp-9;
background-color: $search-background-color;
border-radius: #{$sp-9 / 2};
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
align-items: center;
justify-content: center;
}
.search-results,
.search-button {
border: 1px solid rgba($link-color, 0.3);
}
.search-overlay {
position: fixed;
z-index: 1;
top: 0;
left: 0;
width: 0;
height: 0;
background-color: rgba(0, 0, 0, 0.2);
opacity: 0;
transition: opacity ease 200ms;
}
.search-active {
overflow: hidden;
.search-input-wrap {
margin-right: 0;
margin-left: 0;
}
.search-input {
border-radius: 0;
box-shadow: none;
@include mq(md) {
width: $search-results-width;
}
}
.search-results {
display: block;
}
.search-overlay {
width: 100%;
height: 100%;
opacity: 1;
}
}