Skip to content

Commit d582d90

Browse files
committed
Fixing article layout
1 parent 534d3bf commit d582d90

File tree

9 files changed

+32
-16
lines changed

9 files changed

+32
-16
lines changed

idea/test.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: "Developing a Website Using Astro/MDX"
33
author: "Shawn McGee"
4+
pubDate: "2025-03-18"
45
tags: [
56
"this",
67
"is",

src/components/idea/Author.astro renamed to src/components/article/Author.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ export type Props = {
66
const { author } = Astro.props
77
---
88

9-
<div class="flex flex-row justify-center">
9+
<div class="flex flex-row justify-center p-0">
1010
<span class="text-xl text-center">{author}</span>
1111
</div>

src/components/article/Date.astro

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
export type Props = {
3+
pubDate: Date | undefined
4+
}
5+
6+
const { pubDate } = Astro.props
7+
---
8+
<div class="flex flex-row justify-center">
9+
<span class="text-center text-xl">{pubDate?.toDateString()}</span>
10+
</div>
11+
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/idea/Date.astro

Whitespace-only changes.

src/layouts/Article.astro

Lines changed: 0 additions & 5 deletions
This file was deleted.

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

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import { getCollection, render } from "astro:content";
33
import Layout from "@layouts/Layout.astro";
44
import Drawer from "@layouts/Drawer.astro";
5-
import Article from "@layouts/Article.astro";
65
7-
import Tags from "@components/idea/Tags.astro";
8-
import Title from "@components/idea/Title.astro";
9-
import Author from "@components/idea/Author.astro";
6+
import Tags from "@components/article/Tags.astro";
7+
import Title from "@components/article/Title.astro";
8+
import Author from "@components/article/Author.astro";
9+
import Date from "@components/article/Date.astro";
1010
1111
export async function getStaticPaths() {
1212
const ideas = await getCollection("ideas");
@@ -27,11 +27,20 @@ const { Content } = await render(idea);
2727

2828
<Layout>
2929
<Drawer>
30-
<Article>
31-
<Author author={idea.data.author}/>
32-
<Title title={idea.data.title}/>
33-
<Tags tags={idea.data.tags}/>
34-
<Content/>
35-
</Article>
30+
<div class="flex flex-col w-full items-center">
31+
<div class="flex flex-col w-[960px] min-h-dvh items-center">
32+
<div class="flex flex-col w-full items-center p-4">
33+
<Title title={idea.data.title}/>
34+
<div class="flex flex-row w-full justify-center text-xl gap-2">
35+
<Author author={idea.data.author}/>|
36+
<Date pubDate={idea.data.pubDate}/>
37+
</div>
38+
<Tags tags={idea.data.tags}/>
39+
</div>
40+
<div class="flex flex-col w-full p-8 prose shadow-lg flex-1">
41+
<Content/>
42+
</div>
43+
</div>
44+
</div>
3645
</Drawer>
3746
</Layout>

0 commit comments

Comments
 (0)