Skip to content

Commit

Permalink
Merge pull request google#276 from tekezo/feature/offline-search-rede…
Browse files Browse the repository at this point in the history
…sign

Update offline search result design
  • Loading branch information
LisaFC committed Jun 15, 2020
2 parents 2c4a0a5 + 0176e3d commit f75dcb3
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions assets/js/offline-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,27 +143,30 @@
);
} else {
results.forEach((r) => {
const $cardHeader = $('<div>').addClass('card-header');
const doc = resultDetails.get(r.ref);
const href =
$searchInput.data('offline-search-base-href') +
r.ref.replace(/^\//, '');

$cardHeader.append(
$('<a>').attr('href', href).text(doc.title)
const $entry = $('<div>').addClass('mt-4');

$entry.append(
$('<small>').addClass('d-block text-muted').text(r.ref)
);

const $cardBody = $('<div>').addClass('card-body');
$cardBody.append(
$('<p>')
.addClass('card-text text-muted')
.text(doc.excerpt)
$entry.append(
$('<a>')
.addClass('d-block')
.css({
fontSize: '1.2rem',
})
.attr('href', href)
.text(doc.title)
);

const $card = $('<div>').addClass('card');
$card.append($cardHeader).append($cardBody);
$entry.append($('<p>').text(doc.excerpt));

$searchResultBody.append($card);
$searchResultBody.append($entry);
});
}

Expand Down

0 comments on commit f75dcb3

Please sign in to comment.