1
0
mirror of https://github.com/thangisme/notes.git synced 2025-01-18 04:16:24 -05:00

Fix up search results display

This commit is contained in:
Patrick Marsceill 2019-08-13 17:24:36 -04:00
parent 2b2ebf6033
commit d0325e948e
No known key found for this signature in database
GPG Key ID: 286B93882D828F40
2 changed files with 55 additions and 40 deletions

View File

@ -106,52 +106,62 @@
.search-result { .search-result {
display: block; display: block;
padding-top: $sp-1; padding-top: $sp-1;
padding-right: $sp-3;
padding-bottom: $sp-1; padding-bottom: $sp-1;
padding-left: $sp-3; padding-left: $sp-3;
padding-right: $sp-3;
&:hover, &.active { &:hover,
background-color: darken($search-background-color, 5%); &.active {
background-color: $sidebar-color;
} }
@include mq(md) { @include mq(md) {
padding-left: $sp-4;
padding-right: $sp-4; padding-right: $sp-4;
}
.search-result-title {
display: block;
padding-top: $sp-2;
padding-bottom: $sp-2;
padding-right: $sp-4;
@include mq(sm) {
display: inline-block;
width: 40%;
vertical-align: top;
word-wrap: break-word;
}
}
.search-result-preview {
display: block;
padding-top: $sp-2;
padding-bottom: $sp-2;
padding-left: $sp-4; padding-left: $sp-4;
border-left: $border;
border-left-color: $border-color;
color: $search-result-preview-color;
@include fs-2;
@include mq(sm) {
display: inline-block;
width: 60%;
vertical-align: top;
}
}
.search-result-highlight {
color: $link-color;
font-weight: bold;
} }
} }
.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;
}

View File

@ -194,6 +194,11 @@ function initSearch() {
resultTitle.innerText = doc.title; resultTitle.innerText = doc.title;
resultLink.appendChild(resultTitle); resultLink.appendChild(resultTitle);
var resultRelUrl = document.createElement('span');
resultRelUrl.classList.add('search-result-rel-url');
resultRelUrl.innerText = doc.relUrl;
resultTitle.appendChild(resultRelUrl);
var metadata = result.matchData.metadata; var metadata = result.matchData.metadata;
var contentFound = false; var contentFound = false;
for (var j in metadata) { for (var j in metadata) {
@ -286,4 +291,4 @@ jtd.onReady(function(){
})(window.jtd = window.jtd || {}); })(window.jtd = window.jtd || {});
{% include_relative _custom.js %} {% include_relative _custom.js %}