-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from markteekman/develop
Develop
- Loading branch information
Showing
11 changed files
with
188 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ ul { | |
padding: 0; | ||
} | ||
|
||
ul { | ||
ul:where([class]) { | ||
list-style: none; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
const { | ||
title, | ||
description, | ||
url, | ||
image, | ||
} = Astro.props | ||
let subtitle = 'Accessible Astro Starter' | ||
--- | ||
|
||
<!-- open graph --> | ||
<meta property="og:title" content={`${title} - ${subtitle}`}> | ||
<meta property="og:description" content={description}> | ||
<meta property="og:type" content="website"> | ||
<meta property="og:url" content={url}> | ||
<meta property="og:image" content={Astro.site ? `${Astro.site}${image}` : image}> | ||
|
||
<!-- page title --> | ||
<title>{title} - {subtitle}</title> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
import DefaultLayout from '../../layouts/DefaultLayout.astro' | ||
import { Card, Pagination } from 'accessible-astro-components' | ||
export async function getStaticPaths({ paginate }) { | ||
const response = await fetch('https://jsonplaceholder.typicode.com/posts') | ||
const data = await response.json() | ||
return paginate(data, { pageSize: 6 }) | ||
} | ||
const { page } = Astro.props | ||
--- | ||
|
||
<DefaultLayout | ||
title="Blog" | ||
description="An example of a blog with dynamic content fetched from JSONPlaceholder using the title, body and userId." | ||
> | ||
<section class="margin-48"> | ||
<div class="container"> | ||
<h1>Blog</h1><br> | ||
<p class="size-18">An example of a blog with dynamic content fetched from <a href="https://jsonplaceholder.typicode.com/posts">JSONPlaceholder</a> using the title, body and userId. The <a href="https://components.accessible-astro.dev/card">Accessible Astro Card Component</a> is used here to display al the posts.</p> | ||
</div> | ||
</section> | ||
<section class="margin-48"> | ||
<div class="container"> | ||
<p class="size-12"><em>Post {page.start + 1} through {page.end + 1} of {page.total} total posts</em></p> | ||
<ul class="margin-12"> | ||
{page.data.map((post) => ( | ||
<li> | ||
<Card | ||
url={'/blog/' + post.title.replaceAll(' ', '-').toLowerCase()} | ||
title={post.title} | ||
footer={'userId:' + post.userId} | ||
> | ||
{post.body} | ||
</Card> | ||
</li> | ||
))} | ||
</ul> | ||
<div class="align-center margin-32 top"> | ||
<Pagination | ||
firstPage={page.url.prev ? '/blog' : null} | ||
previousPage={page.url.prev ? page.url.prev : null} | ||
nextPage={page.url.next ? page.url.next : null} | ||
lastPage={page.url.next ? `/blog/${Math.round(page.total / page.size)}` : null} | ||
currentPage={page.currentPage} | ||
totalPages={Math.round(page.total / page.size)} | ||
/> | ||
</div> | ||
</div> | ||
</section> | ||
</DefaultLayout> | ||
|
||
<style lang="scss"> | ||
ul { | ||
display: grid; | ||
grid-template-columns: 1fr; | ||
grid-gap: 4rem; | ||
|
||
@media (min-width: 550px) { | ||
grid-template-columns: repeat(2, 1fr); | ||
grid-gap: 2rem; | ||
} | ||
|
||
@media (min-width: 950px) { | ||
grid-template-columns: repeat(3, 1fr); | ||
} | ||
} | ||
</style> |
Oops, something went wrong.