Skip to content

Commit 2555c59

Browse files
committed
Working on responsive layout
1 parent 3a17c92 commit 2555c59

File tree

9 files changed

+70
-26
lines changed

9 files changed

+70
-26
lines changed

idea/also_test.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
22
title: "This is a Markdown Document"
33
pubDate: 2025-03-19
4-
---
4+
---
5+
6+
# Hello World
7+
I am a markdown document

idea/test.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tags: [
1212

1313
import HelloWorld from "@fun/HelloWorld";
1414

15-
I am MDX
15+
abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz
1616

1717

1818

src/components/Tag.astro

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ export type Props = {
55
66
const { tag } = Astro.props
77
---
8-
<a href={`/idea/tag/#${tag}/`} class="">
9-
<span class="btn btn-ghost rounded-full text-lg text-primary">
10-
#{tag}
11-
</span>
8+
<a href={`/idea/tag/#${tag}/`} class="px-2 rounded-full border-1 border-primary text-primary hover:bg-primary hover:bg-text-primary-content">
9+
# {tag}
1210
</a>

src/components/Tags.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import Tag from "@components/Tag.astro"
33
44
export type Props = {
55
tags: Array<string> | undefined
6+
class: string
67
}
78
8-
const { tags } = Astro.props
9+
const { tags, class: className } = Astro.props
910
---
1011

11-
<div class="flex flex-row justify-center">
12+
<div class:list={[className, "flex flex-row w-full justify-center gap-1"]}>
1213
{tags?.map(tag => <Tag {tag}/>)}
1314
</div>

src/layouts/Drawer.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { BookMarked, CircleHelp, House, LibraryBig, Moon, Sun } from 'lucide-ast
1010
<!-- Page content here -->
1111
<slot />
1212

13-
<label for="my-drawer" class="btn btn-xl btn-ghost btn-circle absolute top-4 left-4">
14-
<BookMarked class="w-10 h-10"/>
13+
<label for="my-drawer" class="btn btn-xl btn-ghost btn-circle absolute top-4 left-4 sm:btn-xl">
14+
<BookMarked class="w-10 h-10" />
1515
</label>
1616

1717
<button class="btn btn-xl btn-ghost btn-circle absolute top-4 right-4" data-toggle-theme="valentine,dracula" data-act-class="ACTIVECLASS">
@@ -27,7 +27,7 @@ import { BookMarked, CircleHelp, House, LibraryBig, Moon, Sun } from 'lucide-ast
2727
<ul class="menu bg-base-200 text-base-content min-h-full w-80 p-4">
2828
<!-- Sidebar content here -->
2929

30-
<span class="p-1 text-3xl font-bold font-[Fragment_Mono] dark:text-primary">
30+
<span class="p-1 text-2xl font-bold font-[Fragment_Mono] dark:text-primary">
3131
/goto
3232
</span>
3333

@@ -38,7 +38,7 @@ import { BookMarked, CircleHelp, House, LibraryBig, Moon, Sun } from 'lucide-ast
3838
</a></li>
3939

4040
<!-- Blog -->
41-
<li><a class="flex flex-row gap-1 text-2xl" href="/blog">
41+
<li><a class="flex flex-row gap-1 text-2xl" href="/idea">
4242
<span class="flex-1">Blog</span>
4343
<LibraryBig/>
4444
</a></li>

src/pages/404.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ import { House } from "lucide-astro";
1616
</span>
1717
</div>
1818
</Drawer>
19-
</Layout>
19+
</Layout>

src/pages/500.astro

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
import Layout from "@layouts/Layout.astro";
3+
import Drawer from "@layouts/Drawer.astro";
4+
import { House } from "lucide-astro";
5+
---
6+
7+
<Layout>
8+
<Drawer>
9+
<div class="flex flex-col w-full h-full justify-center items-center">
10+
<span class="text-6xl font-bold text-center sm:text-8xl dark:text-primary">500</span>
11+
<span class="text-xl text-center">Internal Server Error</span>
12+
<span class="tooltip tooltip-bottom" data-tip="Home">
13+
<a class="btn btn-xl btn-ghost btn-circle" href="/">
14+
<House class="w-10 h-10"/>
15+
</a>
16+
</span>
17+
</div>
18+
</Drawer>
19+
</Layout>

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

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Tags from "@components/Tags.astro";
77
88
export async function getStaticPaths() {
99
const ideas = await getCollection("ideas");
10+
1011
return ideas.map(idea => {
1112
let slug = idea.filePath
1213
slug = slug?.replace(/^idea\//, "");
@@ -24,20 +25,32 @@ const { Content } = await render(idea);
2425

2526
<Layout>
2627
<Drawer>
27-
<div class="flex flex-col w-full items-center">
28-
<div class="flex flex-col w-[960px] min-h-dvh items-center">
29-
<div class="flex flex-col w-full items-center p-4">
30-
<span class="text-4xl font-bold text-center">{idea.data.title}</span>
31-
<div class="flex flex-row w-full justify-center gap-2 text-xl">
32-
<span>{idea.data.author }</span>
33-
{ (idea.data.author && idea.data.pubDate) ? "|" : "" }
34-
<span>{idea.data.pubDate?.toDateString()}</span>
35-
</div>
36-
<Tags tags={idea.data.tags}/>
37-
</div>
38-
<div class="flex flex-col w-full p-8 prose shadow-lg flex-1">
39-
<Content/>
28+
<!-- Container -->
29+
<div class="flex flex-col w-full min-h-dvh items-center">
30+
<!-- Spacing -->
31+
<div class="h-4"></div>
32+
33+
<!-- Header -->
34+
<div class="flex flex-col w-3xs items-center sm:w-lg">
35+
<!-- Author | Date -->
36+
<div class="hidden sm:flex flex-row w-full justify-center gap-2 text-lg">
37+
<span>{idea.data.author }</span>
38+
{ (idea.data.author && idea.data.pubDate) ? "|" : "" }
39+
<span>{idea.data.pubDate?.toDateString()}</span>
4040
</div>
41+
42+
<!-- Title -->
43+
<span class="text-2xl text-center font-bold sm:text-4xl">
44+
{idea.data.title}
45+
</span>
46+
47+
<!-- Tags -->
48+
<Tags tags={idea.data.tags} class="text-sm sm:text-lg"/>
49+
</div>
50+
51+
<!-- Article -->
52+
<div class="flex flex-col w-full flex-1 sm:max-w-2xl sm:shadow-lg prose prose-sm sm:prose-lg break-words sm:break-normal p-8">
53+
<Content/>
4154
</div>
4255
</div>
4356
</Drawer>

src/pages/idea/index.astro

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
import Layout from "@layouts/Layout.astro";
3+
import Drawer from "@layouts/Drawer.astro";
4+
---
5+
6+
<Layout>
7+
<Drawer>
8+
This is the idea page
9+
</Drawer>
10+
</Layout>

0 commit comments

Comments
 (0)