Skip to content

Commit d222b10

Browse files
committed
Add notes pages and first entry
1 parent b1b438b commit d222b10

6 files changed

Lines changed: 104 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: UI Design Fundamentals
3+
dateCreated: 2023-06-23
4+
dateUpdated: 2023-06-23
5+
---
6+
7+
- White space
8+
- Color
9+
- Contrast
10+
- Scale
11+
- Alignment
12+
- Typography
13+
- Visual hierarchy
14+
15+
## References
16+
17+
- <https://www.youtube.com/watch?v=tRpoI6vkqLs>

src/layout/article.astro

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
import "@styles/article.scss";
3+
---
4+
5+
<article>
6+
<slot />
7+
</article>

src/pages/notes.astro

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
import { getCollection } from "astro:content";
3+
4+
import PostItem from "@components/ui/post-item.astro";
5+
import Layout from "@layout/layout.astro";
6+
7+
const notes = await getCollection("notes");
8+
---
9+
10+
<Layout title="Notes">
11+
<h1 class="smaller-spacing">Notes</h1>
12+
<p class="larger-spacing">
13+
Short notes, reminders, or checklists for myself that might also be useful
14+
to you
15+
</p>
16+
<ul>
17+
{
18+
notes
19+
.sort(
20+
(a, b) => b.data.dateCreated.getTime() - a.data.dateCreated.getTime()
21+
)
22+
.map(({ slug, data: { title, dateCreated, dateUpdated } }) => (
23+
<PostItem
24+
{title}
25+
{dateCreated}
26+
{dateUpdated}
27+
link={`/notes/${slug}`}
28+
/>
29+
))
30+
}
31+
</ul>
32+
</Layout>

src/pages/notes/[slug].astro

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
import type { CollectionEntry } from "astro:content";
3+
4+
import { getCollection } from "astro:content";
5+
6+
import Time from "@components/ui/time.astro";
7+
import Article from "@layout/article.astro";
8+
import Layout from "@layout/layout.astro";
9+
10+
export async function getStaticPaths() {
11+
return (await getCollection("notes")).map((note) => ({
12+
params: { slug: note.slug },
13+
props: { note }
14+
}));
15+
}
16+
17+
type Props = { note: CollectionEntry<"notes"> };
18+
const { note } = Astro.props;
19+
const { Content } = await note.render();
20+
---
21+
22+
<Layout title={note.data.title}>
23+
<Article>
24+
<h1 class="smaller-spacing">{note.data.title}</h1>
25+
<p class="small-text larger-spacing">
26+
Created: <Time date={note.data.dateCreated} /> | Updated:
27+
<Time date={note.data.dateUpdated} />
28+
</p>
29+
<Content />
30+
</Article>
31+
</Layout>

src/styles/article.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
article {
2+
h2 {
3+
font-weight: 500;
4+
}
5+
ul {
6+
margin-bottom: v-size(8, "em");
7+
}
8+
li {
9+
list-style: circle inside;
10+
}
11+
}

src/styles/global.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ path {
127127
h1.larger-spacing {
128128
margin-bottom: v-size(5, "em");
129129
}
130+
h1.smaller-spacing {
131+
margin-bottom: v-size(1, "em");
132+
}
133+
p.larger-spacing {
134+
margin-bottom: v-size(8, "em");
135+
}
130136

131137
@include m-medium {
132138
.small-text {

0 commit comments

Comments
 (0)