-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathposts.tsx
35 lines (34 loc) · 1012 Bytes
/
posts.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
export const title = 'Blog posts'
export const layout = 'layouts/root.tsx'
export const url = '/blog/'
export default (
{ comp, filteredBy, pagination, results, title }: Lume.PageProps,
) => {
return (
<>
<section>
<h1>{title}</h1>
<p>
Search a total of <strong>{pagination?.totalResults}</strong>{' '}
posts, by <code>title</code> or <code>tag</code>.
</p>
</section>
<section id='search-wrapper' className='search-wrapper'>
<comp.blog.search query={filteredBy} />
</section>
<section
id='blog-posts-section'
itemScope
itemType='http://schema.org/Blog'
>
{results?.map((data, index) => (
<comp.blog.post index={index.toString()} {...data} />
))}
{results?.length === 0 && <p>Sorry, no posts matched your criteria.</p>}
</section>
{pagination?.totalPages! > 1 && (
<comp.blog.pagination pagination={pagination} />
)}
</>
)
}