Skip to content

Commit

Permalink
Merge pull request #45 from markteekman/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
markteekman authored Nov 3, 2022
2 parents 6840d64 + 07c1418 commit da9cb00
Show file tree
Hide file tree
Showing 11 changed files with 188 additions and 116 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "accessible-astro-starter",
"description": "An Accessible Starter Theme for Astro including several accessiblity features and tools to help you build faster.",
"version": "1.5.5",
"version": "1.6.0",
"author": "Mark Teekman",
"homepage": "https://accessible-astro.dev",
"scripts": {
Expand All @@ -11,11 +11,11 @@
"preview": "astro preview"
},
"dependencies": {
"accessible-astro-components": "^1.5.7",
"accessible-astro-components": "^1.6.1",
"astro-icon": "^0.7.3"
},
"devDependencies": {
"astro": "^1.4.4",
"astro": "^1.6.3",
"sass": "^1.49.9"
}
}
56 changes: 27 additions & 29 deletions src/assets/scss/base/_list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,39 @@
@use "breakpoint" as *;
@use "space" as *;

:where(main) ul:not([class]) {
padding: 0 0 0 $space-24;
list-style-type: none;
ul:not([class]),
ol:not([class]) {
margin-left: $space-16;

ul,
ol {
padding: $space-8 $space-16 0;
}

li {
position: relative;
margin-bottom: $space-8;

@include breakpoint(medium) {
margin-bottom: $space-12;
}

&::before {
position: relative;
z-index: 2;
float: left;
clear: both;
margin: 9px 10px 0 -19px;
width: 8px;
height: 8px;
border-radius: 60px;
background: var(--action-color);
content: "";
}
}
}

ul {
padding: $space-16 0 0 $space-16;
ul:not([class]) {
> li::marker {
display: block;
color: var(--primary-800);
}
}

:where(main) ol:not([class]) {
ol.incremented {
counter-reset: item;

ol{
counter-reset: item;
}

ol,
ul {
margin: $space-12 0 0 $space-16;
}

li {
display: block;
margin-bottom: $space-8;
Expand All @@ -52,16 +51,15 @@
counter-increment: item;
}

&:last-child {
margin-bottom: 0;
}

p {
display: inline;
}
}

ol,
ul {
margin: $space-12 0 0 $space-16;
}

ul {
li::before {
content: "";
Expand Down
2 changes: 1 addition & 1 deletion src/assets/scss/base/_reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ul {
padding: 0;
}

ul {
ul:where([class]) {
list-style: none;
}

Expand Down
19 changes: 0 additions & 19 deletions src/assets/scss/base/_root.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,4 @@
--#{$color}-#{$shade}: #{$value};
}
}
--radius-small: 3px;
--radius-large: 6px;
--gap-default: 2rem;
--font-measure: 70ch;
--font-family-default: "Open Sans", sans-serif;
--font-family-special: "Open Sans", sans-serif;
--font-color: var(--neutral-900);
--action-color: var(--secondary-500);
--background: var(--neutral-100);
--primary-background: var(--primary-100);
--neutral-background: var(--neutral-200);
}

.darkmode {
--font-color: var(--neutral-100);
--action-color: var(--secondary-100);
--background: var(--neutral-800);
--primary-background: var(--primary-500);
--neutral-background: var(--neutral-900);
}
1 change: 1 addition & 0 deletions src/components/Navigation.astro
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ import { DarkMode } from 'accessible-astro-components'
> ul {
display: flex;
gap: 1.5rem;
list-style-type: none;

.is-active {
font-weight: bold;
Expand Down
20 changes: 20 additions & 0 deletions src/components/SiteMeta.astro
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>
53 changes: 42 additions & 11 deletions src/layouts/DefaultLayout.astro
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
---
import '../assets/scss/globals.scss'
import SiteMeta from '../components/SiteMeta.astro'
import Header from '../components/Header.astro'
import Footer from '../components/Footer.astro'
const {title} = Astro.props
let subtitle = 'Accessible Astro Starter'
const {
title = 'Astro',
description = 'A starter project with accessible features using Astro static site builder. Contains accessible landmarks, skip links, a dark mode color scheme, better focus outline and keyboard menu navigation.',
url,
image = '/social-preview-image.png',
} = Astro.props
---

<html lang="en" dir="ltr">
Expand All @@ -21,15 +26,16 @@ let subtitle = 'Accessible Astro Starter'
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;800&display=swap" rel="stylesheet">

<!-- open graph -->
<meta property="og:title" content="Accessible Astro Starter">
<meta property="og:description" content="A starter project with accessible features using Astro static site builder. Contains accessible landmarks, skip links, a dark mode color scheme, better focus outline and keyboard menu navigation.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://starter.accessible-astro.dev">
<meta property="og:image" content="/social-preview-image.png">

<!-- page title -->
<title>{title} - {subtitle}</title>
<SiteMeta
title={title}
description={description.substring(0, 100)}
url={
Astro.site
? `${Astro.site}/${title.toLowerCase().replaceAll(' ', '-')}`
: `https://accessible-astro.dev/${title.toLowerCase().replaceAll(' ', '-')}`
}
image={image}
/>
</head>
<body>
<Header />
Expand All @@ -41,6 +47,31 @@ let subtitle = 'Accessible Astro Starter'
</html>

<style lang="scss">
// theme settings
:root {
--radius-small: 3px;
--radius-large: 6px;
--gap-default: 2rem;
--font-measure: 70ch;
--font-family-default: "Open Sans", sans-serif;
--font-family-special: "Open Sans", sans-serif;
// light theme
--font-color: var(--neutral-900);
--action-color: var(--secondary-500);
--background: var(--neutral-100);
--primary-background: var(--primary-100);
--neutral-background: var(--neutral-200);
}

// dark color scheme overrides
.darkmode {
--font-color: var(--neutral-100);
--action-color: var(--secondary-100);
--background: var(--neutral-800);
--primary-background: var(--primary-500);
--neutral-background: var(--neutral-900);
}

// sticky footer on low content pages
html,
body {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/404.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import DefaultLayout from '../layouts/DefaultLayout.astro'
---

<DefaultLayout title="About">
<DefaultLayout title="404">
<section class="margin-48">
<div class="container">
<h1>404</h1><br>
Expand Down
50 changes: 0 additions & 50 deletions src/pages/blog.astro

This file was deleted.

70 changes: 70 additions & 0 deletions src/pages/blog/[...page].astro
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>
Loading

0 comments on commit da9cb00

Please sign in to comment.