|
| 1 | +import getArchivePosts from '@/api/frontend/wp/archive/getArchivePosts' |
| 2 | +import postComment from '@/api/frontend/wp/comments/postComment' |
1 | 3 | import getPostTypeStaticPaths from '@/api/wordpress/_global/getPostTypeStaticPaths'
|
2 | 4 | import getPostTypeStaticProps from '@/api/wordpress/_global/getPostTypeStaticProps'
|
| 5 | +import Button from '@/components/atoms/Button' |
| 6 | +import Text from '@/components/atoms/Inputs/Text' |
3 | 7 | import Layout from '@/components/common/Layout'
|
4 |
| -import Link from 'next/link' |
5 |
| -import getArchivePosts from '@/api/frontend/wp/archive/getArchivePosts' |
6 |
| -import postComment from '@/api/frontend/wp/comments/postComment' |
7 |
| -import getPagePropTypes from '@/functions/getPagePropTypes' |
8 | 8 | import Blocks from '@/components/molecules/Blocks'
|
| 9 | +import Card from '@/components/molecules/Card' |
9 | 10 | import Form from '@/components/molecules/Form'
|
10 |
| -import Text from '@/components/atoms/Inputs/Text' |
| 11 | +import getPagePropTypes from '@/functions/getPagePropTypes' |
11 | 12 | import * as Yup from 'yup'
|
12 | 13 |
|
13 | 14 | // Define route post type.
|
@@ -38,28 +39,28 @@ export default function BlogPost({post, archive, posts, pagination}) {
|
38 | 39 | if (archive) {
|
39 | 40 | return (
|
40 | 41 | <Layout seo={{...post?.seo}}>
|
41 |
| - <div className="container py-20"> |
42 |
| - <section> |
43 |
| - {!posts || !posts.length ? ( |
44 |
| - <p>No posts found.</p> |
45 |
| - ) : ( |
46 |
| - posts.map((post, index) => ( |
47 |
| - <article key={index}> |
48 |
| - <Link href={post?.uri}> |
49 |
| - <a> |
50 |
| - <h1 dangerouslySetInnerHTML={{__html: post?.title}} /> |
51 |
| - </a> |
52 |
| - </Link> |
53 |
| - <div dangerouslySetInnerHTML={{__html: post?.excerpt}} /> |
54 |
| - </article> |
55 |
| - )) |
56 |
| - )} |
57 |
| - {/* TODO: replace this with a component. */} |
58 |
| - <button onClick={loadPosts} disabled={!pagination.hasNextPage}> |
59 |
| - Load more |
60 |
| - </button> |
61 |
| - </section> |
62 |
| - </div> |
| 42 | + <section className="container py-20"> |
| 43 | + {!posts || !posts.length ? ( |
| 44 | + <p>No posts found.</p> |
| 45 | + ) : ( |
| 46 | + <div className="w-1/3 grid grid-cols-1 gap-12"> |
| 47 | + {posts.map((post, index) => ( |
| 48 | + <Card |
| 49 | + key={index} |
| 50 | + title={post?.title} |
| 51 | + url={post?.uri} |
| 52 | + body={post?.excerpt} |
| 53 | + /> |
| 54 | + ))} |
| 55 | + </div> |
| 56 | + )} |
| 57 | + <Button |
| 58 | + onClick={() => loadPosts} |
| 59 | + text="Load More" |
| 60 | + type="secondary" |
| 61 | + disabled={!pagination.hasNextPage} |
| 62 | + /> |
| 63 | + </section> |
63 | 64 | </Layout>
|
64 | 65 | )
|
65 | 66 | }
|
|
0 commit comments