notes/_sass/search.scss

324 lines
5.9 KiB
SCSS
Raw Permalink Normal View History

2017-03-27 01:09:19 +00:00
//
// Search input and autocomplete
//
.search {
2018-10-23 15:40:39 +00:00
position: relative;
2019-12-03 08:12:54 +00:00
z-index: 2;
2018-10-23 15:40:39 +00:00
flex-grow: 1;
2019-12-03 08:12:54 +00:00
height: $sp-10;
padding: $sp-2;
transition: padding linear #{$transition-duration / 2};
2017-03-27 01:09:19 +00:00
@include mq(md) {
position: relative !important;
width: auto !important;
height: 100% !important;
padding: 0;
transition: none;
2017-03-27 01:09:19 +00:00
}
}
.search-input-wrap {
2019-12-03 08:12:54 +00:00
position: relative;
z-index: 1;
height: $sp-8;
2020-06-13 20:44:30 +00:00
overflow: hidden;
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: height linear #{$transition-duration / 2};
@include mq(md) {
position: absolute;
width: 100%;
max-width: $search-results-width;
height: 100% !important;
border-radius: 0;
box-shadow: none;
transition: width ease $transition-duration;
}
2017-03-27 01:09:19 +00:00
}
.search-input {
2019-12-03 08:12:54 +00:00
position: absolute;
2017-11-08 16:23:05 +00:00
width: 100%;
2019-12-03 08:12:54 +00:00
height: 100%;
padding-top: $sp-2;
padding-right: $gutter-spacing-sm;
padding-bottom: $sp-2;
padding-left: #{$gutter-spacing-sm + $sp-5};
2020-06-13 20:44:30 +00:00
font-size: 16px;
2019-05-19 00:41:40 +00:00
background-color: $search-background-color;
2017-03-27 01:09:19 +00:00
border-top: 0;
border-right: 0;
2017-06-04 21:50:01 +00:00
border-bottom: 0;
2017-03-27 01:09:19 +00:00
border-left: 0;
border-radius: 0;
2017-03-27 01:09:19 +00:00
2019-12-03 08:12:54 +00:00
@include mq(md) {
padding-top: $gutter-spacing-sm;
padding-bottom: $gutter-spacing-sm;
2019-12-04 17:11:44 +00:00
padding-left: #{$gutter-spacing + $sp-5};
2020-06-13 20:44:30 +00:00
font-size: 14px;
2019-12-03 08:12:54 +00:00
background-color: $body-background-color;
transition: padding-left linear #{$transition-duration / 2};
2019-12-03 08:12:54 +00:00
}
2017-03-27 01:09:19 +00:00
&:focus {
outline: 0;
2019-12-03 08:12:54 +00:00
+ .search-label .search-icon {
2020-06-25 21:48:24 +00:00
color: $link-color;
2017-03-27 01:09:19 +00:00
}
}
2019-12-03 08:12:54 +00:00
}
.search-label {
position: absolute;
display: flex;
height: 100%;
padding-left: $gutter-spacing-sm;
2018-10-24 18:05:29 +00:00
@include mq(md) {
2019-12-03 08:12:54 +00:00
padding-left: $gutter-spacing;
transition: padding-left linear #{$transition-duration / 2};
2018-10-24 18:05:29 +00:00
}
2017-03-27 01:09:19 +00:00
2019-12-03 08:12:54 +00:00
.search-icon {
width: #{$sp-4 * 1.2};
height: #{$sp-4 * 1.2};
align-self: center;
2020-06-25 21:48:24 +00:00
color: $grey-dk-000;
2019-12-03 08:12:54 +00:00
}
2017-03-27 01:09:19 +00:00
}
.search-results {
position: absolute;
left: 0;
2019-08-13 21:24:23 +00:00
display: none;
width: 100%;
max-height: calc(100% - #{$sp-10});
2019-12-03 08:12:54 +00:00
overflow-y: auto;
2019-12-18 19:28:38 +00:00
background-color: $search-background-color;
2019-12-03 08:12:54 +00:00
border-bottom-right-radius: $border-radius;
2019-12-03 08:20:22 +00:00
border-bottom-left-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) {
top: 100%;
width: $search-results-width;
max-height: calc(100vh - 200%) !important;
}
}
2017-03-27 01:09:19 +00:00
.search-results-list {
padding-left: 0;
margin-bottom: $sp-1;
list-style: none;
@include fs-4;
@include mq(md) {
@include fs-3;
}
2017-03-27 01:09:19 +00:00
}
.search-results-list-item {
padding: 0;
margin: 0;
}
.search-result {
2017-03-27 01:09:19 +00:00
display: block;
padding-top: $sp-1;
2019-08-13 21:24:36 +00:00
padding-right: $sp-3;
2017-03-27 01:09:19 +00:00
padding-bottom: $sp-1;
padding-left: $sp-3;
2019-08-13 21:24:36 +00:00
&:hover,
&.active {
background-color: $feedback-color;
}
2019-08-13 21:24:36 +00:00
}
2019-08-13 21:24:36 +00:00
.search-result-title {
display: block;
padding-top: $sp-2;
padding-bottom: $sp-2;
@include mq(sm) {
display: inline-block;
width: 40%;
padding-right: $sp-2;
2019-08-13 21:24:36 +00:00
vertical-align: top;
}
2019-08-13 21:24:36 +00:00
}
.search-result-doc {
display: flex;
align-items: center;
2020-01-02 12:18:39 +00:00
word-wrap: break-word;
&.search-result-doc-parent {
opacity: 0.5;
@include fs-3;
@include mq(md) {
@include fs-2;
}
}
.search-result-icon {
width: $sp-4;
height: $sp-4;
margin-right: $sp-2;
2020-06-25 21:48:24 +00:00
color: $link-color;
2020-01-02 13:20:09 +00:00
flex-shrink: 0;
}
.search-result-doc-title {
overflow: auto;
}
}
.search-result-section {
margin-left: #{$sp-4 + $sp-2};
2020-01-02 12:18:39 +00:00
word-wrap: break-word;
}
2019-08-13 21:24:36 +00:00
.search-result-rel-url {
display: block;
margin-left: #{$sp-4 + $sp-2};
2019-08-13 21:24:36 +00:00
overflow: hidden;
color: $search-result-preview-color;
text-overflow: ellipsis;
white-space: nowrap;
@include fs-1;
}
.search-result-previews {
2019-08-13 21:24:36 +00:00
display: block;
padding-top: $sp-2;
padding-bottom: $sp-2;
padding-left: $sp-4;
margin-left: $sp-2;
2019-08-13 21:24:36 +00:00
color: $search-result-preview-color;
2020-01-03 07:58:38 +00:00
word-wrap: break-word;
2019-08-13 21:24:36 +00:00
border-left: $border;
border-left-color: $border-color;
@include fs-2;
@include mq(sm) {
display: inline-block;
width: 60%;
padding-left: $sp-2;
margin-left: 0;
2019-08-13 21:24:36 +00:00
vertical-align: top;
2017-03-27 01:09:19 +00:00
}
2017-03-24 13:47:37 +00:00
}
2019-08-13 21:24:36 +00:00
.search-result-preview + .search-result-preview {
margin-top: $sp-1;
}
2019-08-13 21:24:36 +00:00
.search-result-highlight {
font-weight: bold;
}
.search-no-result {
padding-top: $sp-2;
padding-right: $sp-3;
padding-bottom: $sp-2;
padding-left: $sp-3;
@include fs-3;
2019-08-13 21:24:36 +00:00
}
.search-button {
position: fixed;
right: $sp-4;
bottom: $sp-4;
display: flex;
width: $sp-9;
height: $sp-9;
background-color: $search-background-color;
2019-12-18 19:28:38 +00:00
border: 1px solid rgba($link-color, 0.3);
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;
}
2019-12-03 08:12:54 +00:00
.search-overlay {
position: fixed;
top: 0;
left: 0;
2019-12-03 08:21:35 +00:00
z-index: 1;
2019-12-03 08:12:54 +00:00
width: 0;
height: 0;
background-color: rgba(0, 0, 0, 0.3);
2019-12-03 08:12:54 +00:00
opacity: 0;
2020-06-25 19:42:41 +00:00
transition: opacity ease $transition-duration, width 0s $transition-duration,
height 0s $transition-duration;
2019-12-03 08:12:54 +00:00
}
.search-active {
.search {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 0;
}
2019-12-03 08:12:54 +00:00
.search-input-wrap {
height: $sp-10;
border-radius: 0;
@include mq(md) {
width: $search-results-width;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 3px 10px rgba(0, 0, 0, 0.08);
}
2019-12-03 08:12:54 +00:00
}
.search-input {
2019-12-18 19:28:38 +00:00
background-color: $search-background-color;
2019-12-03 08:12:54 +00:00
@include mq(md) {
2020-09-11 21:18:44 +00:00
padding-left: 2.3rem;
2019-12-03 08:12:54 +00:00
}
}
.search-label {
@include mq(md) {
2020-09-11 21:18:44 +00:00
padding-left: 0.6rem;
}
}
2019-12-03 08:12:54 +00:00
.search-results {
display: block;
}
.search-overlay {
width: 100%;
height: 100%;
opacity: 1;
transition: opacity ease $transition-duration, width 0s, height 0s;
2019-12-03 08:12:54 +00:00
}
@include mq(md) {
.main {
position: fixed;
2020-06-30 18:07:25 +00:00
right: 0;
left: 0;
2019-12-04 21:27:43 +00:00
}
}
.main-header {
padding-top: $sp-10;
@include mq(md) {
padding-top: 0;
}
}
}