diff --git a/package-lock.json b/package-lock.json
index 0fff91d..0ce0595 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,10 +12,10 @@
"@picocss/pico": "^1.5.6",
"astro": "^1.6.13",
"astro-remote": "^0.2.3",
- "date-fns": "^2.29.3",
- "prettier": "^2.8.1"
+ "date-fns": "^2.29.3"
},
"devDependencies": {
+ "prettier": "^2.8.1",
"prettier-plugin-astro": "^0.7.0"
}
},
diff --git a/src/components/BlogHeader.astro b/src/components/BlogHeader.astro
new file mode 100644
index 0000000..76644a7
--- /dev/null
+++ b/src/components/BlogHeader.astro
@@ -0,0 +1,15 @@
+---
+import { format } from "date-fns";
+
+interface Props {
+ title: String;
+ date: String;
+}
+
+const { title, date } = Astro.props;
+---
+
+
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 0644cb1..3c1a8bc 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -1,8 +1,8 @@
---
-import { format } from "date-fns";
import { Markup } from "astro-remote";
import Layout from "../layouts/Layout.astro";
+import BlogHeader from "../components/BlogHeader.astro";
const response = await fetch(
`https://api.cosmicjs.com/v2/buckets/${
@@ -26,13 +26,7 @@ const posts = await response.json();
) : null}
-
-
{post.title}
- {`🗓️ ${format(
- new Date(post.published_at),
- "MMM do, y"
- )}`}
-
+
${post.content.split("")[0]}`} />
Read More
diff --git a/src/pages/posts/[slug].astro b/src/pages/posts/[slug].astro
index 453a12d..8ecae6d 100644
--- a/src/pages/posts/[slug].astro
+++ b/src/pages/posts/[slug].astro
@@ -3,6 +3,7 @@ import { format } from "date-fns";
import { Markup } from "astro-remote";
import Layout from "../../layouts/Layout.astro";
+import BlogHeader from "../../components/BlogHeader.astro";
const { slug } = Astro.params;
@@ -27,10 +28,9 @@ const post = posts.objects[0];
) : null
}
-
-
{post.title}
-
{`🗓️ ${format(new Date(post.published_at), "MMM do, y")}`}
+
+
+
-
diff --git a/src/styles/global.css b/src/styles/global.css
index bb427b3..d2a09d6 100644
--- a/src/styles/global.css
+++ b/src/styles/global.css
@@ -1,3 +1,20 @@
img {
border-radius: 5px;
}
+
+.blog-header {
+ display: flex;
+ justify-content: space-between;
+}
+
+.blog-header h5 {
+ font-size: 1rem;
+ font-weight: normal;
+}
+
+@media (max-width: 768px) {
+ .blog-header {
+ flex-direction: column;
+ justify-content: left;
+ }
+}