Skip to content

Commit 9b8c8c6

Browse files
committed
Working on responsive layout
1 parent 62c3ece commit 9b8c8c6

File tree

4 files changed

+53
-24
lines changed

4 files changed

+53
-24
lines changed

idea/patchwork_electronics.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ title: Patchwork Electronics
33
author: Shawn McGee
44
tags: [
55
"patchwork",
6-
"electronics"
6+
"electronics",
7+
"developer"
78
]
89
---
910

src/pages/idea/index.astro

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ const ideas = (await getCollection("ideas"))
1919
<div class="h-4"></div>
2020
<span class="text-6xl font-bold text-center">Ideas</span>
2121
<div class="h-4"></div>
22-
<div class="w-full grid grid-cols-1 max-w-xs sm:grid-cols-2 sm:max-w-2xl lg:grid-cols-3 lg:max-w-5xl">
22+
<div class="w-full flex flex-row flex-wrap max-w-xs justify-center sm:max-w-2xl lg:max-w-5xl">
2323
{ ideas.map(idea => (
24-
<a href={`/idea/${Idea.slug(idea)}`} class="flex flex-row items-center p-4 rounded-lg hover:bg-base-200">
24+
<a href={`/idea/${Idea.slug(idea)}`} class="flex flex-row flex-1 max-w-xs items-center p-4 rounded-lg hover:bg-base-200">
2525
{ !Idea.isDraft(idea) && <Lightbulb class="w-10 h-10"/> }
2626
{ Idea.isDraft(idea) && <Construction class="w-10 h-10"/> }
2727
<div class="divider divider-horizontal"></div>
@@ -32,7 +32,6 @@ const ideas = (await getCollection("ideas"))
3232
</a>
3333
))}
3434
</div>
35-
3635
</div>
3736
</Drawer>
3837
</Layout>

src/pages/idea/tag/[tag].astro

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export async function getStaticPaths() {
1111
if(!tags.includes(tag)) tags.push(tag)
1212
})
1313
return tags
14-
}, new Array<string>).map(tag => ({
14+
}, new Array<string>()).map(tag => ({
1515
params: { tag }
1616
}))
1717
}
@@ -25,24 +25,22 @@ const ideas = (await getCollection("ideas"))
2525
<Layout>
2626
<Drawer>
2727
<div class="flex flex-col w-full items-center">
28+
<div class="h-6"></div>
29+
<span class="text-4xl font-bold"># {tag}</span>
2830
<div class="h-4"></div>
29-
<span class="text-6xl font-bold border-2 rounded-full px-4 py-2"># {tag}</span>
30-
<div class="h-4"></div>
31-
{ ideas.map(idea => (
32-
<a href={`/idea/${Idea.slug(idea)}`} class="flex flex-row items-center p-4 rounded-lg hover:bg-base-200">
33-
{ !Idea.isDraft(idea) && <Lightbulb class="w-10 h-10"/> }
34-
{ Idea.isDraft(idea) && <Construction class="w-10 h-10"/> }
35-
<div class="divider divider-horizontal"></div>
36-
<div class="flex flex-col flex-1 items-start">
37-
<span class="text-lg lg:text-xl font-bold">{idea.data.title }</span>
38-
<div class="text-sm lg:text-lg flex flex-row gap-1 ">
39-
{ idea.data.author && <span>{idea.data.author}</span>}
40-
{ (idea.data.author && idea.data.pubDate) && "|" }
41-
{ idea.data.pubDate && <span>{idea.data.pubDate?.toDateString()}</span>}
31+
<div class="w-full flex flex-row flex-wrap max-w-xs justify-center sm:max-w-2xl lg:max-w-5xl">
32+
{ ideas.map(idea => (
33+
<a href={`/idea/${Idea.slug(idea)}`} class="flex flex-row flex-1 max-w-xs items-center p-4 rounded-lg hover:bg-base-200">
34+
{ !Idea.isDraft(idea) && <Lightbulb class="w-10 h-10"/> }
35+
{ Idea.isDraft(idea) && <Construction class="w-10 h-10"/> }
36+
<div class="divider divider-horizontal"></div>
37+
<div class="flex flex-col flex-1 items-start">
38+
<span class="text-lg sm:text-xl font-bold">{idea.data.title }</span>
39+
{ idea.data.pubDate && <span class="text-sm sm:text-lg">{idea.data.pubDate?.toDateString()}</span>}
4240
</div>
43-
</div>
44-
</a>
45-
))}
41+
</a>
42+
))}
43+
</div>
4644
</div>
4745
</Drawer>
4846
</Layout>

src/pages/idea/tag/index.astro

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1-
<script>
2-
location.href=`/idea/tag/${location.hash.slice(2)}`
3-
</script>
1+
---
2+
import Layout from "@layouts/Layout.astro"
3+
import Drawer from "@layouts/Drawer.astro"
4+
import { getCollection } from "astro:content";
5+
6+
const tags = (await getCollection("ideas"))
7+
.reduce((tags, idea) => {
8+
idea.data.tags?.forEach(tag => {
9+
tags[tag] = (tags[tag] ?? 0) + 1
10+
})
11+
return tags
12+
}, new Object())
13+
14+
---
15+
16+
<Layout>
17+
<Drawer>
18+
<div class="flex flex-col w-full items-center">
19+
<div class="h-6"></div>
20+
<span class="text-4xl font-bold">Tags</span>
21+
<div class="h-4"></div>
22+
<div class="w-full grid grid-cols-1 max-w-xs sm:grid-cols-3 sm:max-w-2xl lg:grid-cols-5 lg:max-w-5xl">
23+
{ Object.entries(tags).sort(([a,], [b,]) => {
24+
return a !== b ? a < b ? -1 : 1 : 0
25+
}).map(([tag, count]) => (
26+
<a href={`/idea/tag/${tag}`} class="flex flex-row gap-1 justify-center items-center p-4 rounded-lg hover:bg-base-200">
27+
<span class="text-lg sm:text-xl font-bold"># {tag}</span>
28+
<span class="badge badge-soft badge-primary badge-xs">{count}</span>
29+
</a>
30+
))}
31+
</div>
32+
</div>
33+
</Drawer>
34+
</Layout>

0 commit comments

Comments
 (0)