Skip to content

Commit b12cb85

Browse files
author
JoelCDL
committed
Create search results template
1 parent 4f71afe commit b12cb85

4 files changed

Lines changed: 79 additions & 0 deletions

File tree

index.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<li><a href="src/templates/blog-index.hbs">Blog Index</a></li>
2121
<li><a href="src/templates/blog-post.hbs">Blog Post</a></li>
2222
<li><a href="src/templates/home.hbs">Home</a></li>
23+
<li><a href="src/templates/search-results.hbs">Search Results</a></li>
2324
<li><a href="src/templates/secondary.hbs">Secondary</a></li>
2425
</ul>
2526
<h2>Components</h2>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* Search Results Template */
2+
3+
.t-search-results {
4+
.c-breadcrumb {
5+
margin-inline: var(--uc3-space-lg);
6+
}
7+
8+
.c-search-result {
9+
margin-block-end: var(--uc3-space-lg);
10+
}
11+
}
12+
13+
.t-search-results__header {
14+
margin-block-end: var(--uc3-space-lg);
15+
16+
h1 {
17+
margin-block: 0 var(--uc3-space-sm);
18+
font-variant: normal;
19+
}
20+
21+
p {
22+
margin-block: unset;
23+
}
24+
}
25+
26+
.t-search-results__content {
27+
padding-block: var(--uc3-space-lg);
28+
padding-inline: var(--template-inline-content-padding);
29+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Search Results Template //
2+
3+
const { faker } = require('@faker-js/faker')
4+
const list = []
5+
6+
for (let i = 0; i < 10; i++) {
7+
const fakerDate = faker.date.past()
8+
const postDateUnformatted = new Date(fakerDate)
9+
const dateFormat = {year: 'numeric', month: 'long', day: 'numeric'}
10+
const postDate = postDateUnformatted.toLocaleDateString('en-US', dateFormat)
11+
12+
list.push({
13+
search_result: {
14+
title: faker.commerce.productDescription(),
15+
description: faker.lorem.sentences({ min: 4, max: 6 }),
16+
date: postDate,
17+
datetime: fakerDate
18+
}
19+
})
20+
}
21+
22+
module.exports = {
23+
items: list,
24+
search_results_breadcrumb: {
25+
breadcrumb: {
26+
text: [
27+
'University of California Curation Center (UC3)',
28+
'Search Results for \"uc3\"'
29+
]
30+
}
31+
}
32+
}

src/templates/search-results.hbs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{#extend "base"}}{{#content "body"}}
2+
<div class="t-search-results">
3+
{{> header }}
4+
{{> breadcrumb search_results_breadcrumb }}
5+
<main id="maincontent" class="t-search-results__content">
6+
<div class="t-search-results__header">
7+
<h1>Search Results</h1>
8+
<p>Showing 1 - 10 of 200 results for "<strong>uc3</strong>"</p>
9+
</div>
10+
{{#each searchresults.items}}
11+
{{> search-result }}
12+
{{/each}}
13+
{{> pagination }}
14+
</main>
15+
{{> footer }}
16+
</div>
17+
{{/content}}{{/extend}}

0 commit comments

Comments
 (0)