cleanup search code fix search entry formatting
parent
42a1b74f42
commit
ce36121096
|
@ -53,21 +53,19 @@
|
||||||
|
|
||||||
const items = [];
|
const items = [];
|
||||||
|
|
||||||
if (showParent) {
|
|
||||||
for (const section in searchHits) {
|
for (const section in searchHits) {
|
||||||
const item = document.createElement('li'),
|
const item = document.createElement('li');
|
||||||
title = item.appendChild(document.createElement('span')),
|
|
||||||
subList = item.appendChild(document.createElement('ul'));
|
|
||||||
|
|
||||||
|
if (showParent) {
|
||||||
|
const title = item.appendChild(document.createElement('span'));
|
||||||
title.textContent = section;
|
title.textContent = section;
|
||||||
title.classList.add('gdoc-search__list__section-title');
|
}
|
||||||
|
|
||||||
|
const subList = item.appendChild(document.createElement('ul'));
|
||||||
createLinks(searchHits[section], subList);
|
createLinks(searchHits[section], subList);
|
||||||
|
|
||||||
items.push(item);
|
items.push(item);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
items.push(...createLinks(searchHits));
|
|
||||||
}
|
|
||||||
|
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
results.appendChild(item);
|
results.appendChild(item);
|
||||||
|
@ -84,11 +82,15 @@
|
||||||
const items = [];
|
const items = [];
|
||||||
|
|
||||||
for (const page of pages) {
|
for (const page of pages) {
|
||||||
const item = document.createElement('li'),
|
const item = document.createElement("li"),
|
||||||
a = item.appendChild(document.createElement('a'));
|
entry = item.appendChild(document.createElement("span")),
|
||||||
|
a = entry.appendChild(document.createElement("a"));
|
||||||
|
|
||||||
|
entry.classList.add("flex")
|
||||||
|
|
||||||
a.href = page.href;
|
a.href = page.href;
|
||||||
a.textContent = page.title;
|
a.textContent = page.title;
|
||||||
|
a.classList.add("gdoc-search__entry")
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
target.appendChild(item);
|
target.appendChild(item);
|
||||||
|
|
|
@ -203,7 +203,20 @@ img {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__entry {
|
&--main > ul > li > span,
|
||||||
|
&--main > ul > li > span > a,
|
||||||
|
&--main > ul > li > label,
|
||||||
|
&--main > ul > li > label > a {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--more {
|
||||||
|
padding-top: $padding-8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.gdoc-nav__entry,
|
||||||
|
.gdoc-search__entry {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
color: $body-font-color;
|
color: $body-font-color;
|
||||||
|
|
||||||
|
@ -218,18 +231,6 @@ img {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&--main > ul > li > span,
|
|
||||||
&--main > ul > li > span > a,
|
|
||||||
&--main > ul > li > label,
|
|
||||||
&--main > ul > li > label > a {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
&--more {
|
|
||||||
padding-top: $padding-8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.gdoc-page {
|
.gdoc-page {
|
||||||
min-width: $body-min-width;
|
min-width: $body-min-width;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
@ -438,7 +439,7 @@ img {
|
||||||
|
|
||||||
&__list {
|
&__list {
|
||||||
display: none;
|
display: none;
|
||||||
background-color: #ffffff;
|
background: $white;
|
||||||
border-radius: $border-radius;
|
border-radius: $border-radius;
|
||||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -461,22 +462,17 @@ img {
|
||||||
}
|
}
|
||||||
|
|
||||||
> li > span {
|
> li > span {
|
||||||
color: $gray-600;
|
|
||||||
font-size: $font-size-14;
|
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
color: $gray-600;
|
||||||
}
|
}
|
||||||
|
|
||||||
> li + li {
|
> li + li {
|
||||||
margin-top: $padding-16;
|
margin-top: $padding-8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
margin-right: $padding-4;
|
margin-right: $padding-4;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
|
||||||
font-size: $font-size-16;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&:focus-within &__list.has-hits {
|
&:focus-within &__list.has-hits {
|
||||||
|
|
Loading…
Reference in New Issue