responsive stuff

This commit is contained in:
Graham Hall
2022-12-09 13:14:45 -05:00
parent 18287083b9
commit 3116dc3889
5 changed files with 40 additions and 14 deletions
+2 -2
View File
@@ -12,10 +12,10 @@
"@picocss/pico": "^1.5.6", "@picocss/pico": "^1.5.6",
"astro": "^1.6.13", "astro": "^1.6.13",
"astro-remote": "^0.2.3", "astro-remote": "^0.2.3",
"date-fns": "^2.29.3", "date-fns": "^2.29.3"
"prettier": "^2.8.1"
}, },
"devDependencies": { "devDependencies": {
"prettier": "^2.8.1",
"prettier-plugin-astro": "^0.7.0" "prettier-plugin-astro": "^0.7.0"
} }
}, },
+15
View File
@@ -0,0 +1,15 @@
---
import { format } from "date-fns";
interface Props {
title: String;
date: String;
}
const { title, date } = Astro.props;
---
<div class="blog-header">
<h4>{title}</h4>
<h5>{`🗓️ ${format(new Date(date), "MMM do, y")}`}</h5>
</div>
+2 -8
View File
@@ -1,8 +1,8 @@
--- ---
import { format } from "date-fns";
import { Markup } from "astro-remote"; import { Markup } from "astro-remote";
import Layout from "../layouts/Layout.astro"; import Layout from "../layouts/Layout.astro";
import BlogHeader from "../components/BlogHeader.astro";
const response = await fetch( const response = await fetch(
`https://api.cosmicjs.com/v2/buckets/${ `https://api.cosmicjs.com/v2/buckets/${
@@ -26,13 +26,7 @@ const posts = await response.json();
</div> </div>
) : null} ) : null}
<div> <div>
<div style={{ display: "flex", justifyContent: "space-between" }}> <BlogHeader title={post.title} date={post.published_at} />
<h4>{post.title}</h4>
<h5>{`🗓️ ${format(
new Date(post.published_at),
"MMM do, y"
)}`}</h5>
</div>
<Markup content={`<p>${post.content.split("</p>")[0]}`} /> <Markup content={`<p>${post.content.split("</p>")[0]}`} />
<a href={`/posts/${post.slug}`}>Read More</a> <a href={`/posts/${post.slug}`}>Read More</a>
</div> </div>
+4 -4
View File
@@ -3,6 +3,7 @@ import { format } from "date-fns";
import { Markup } from "astro-remote"; import { Markup } from "astro-remote";
import Layout from "../../layouts/Layout.astro"; import Layout from "../../layouts/Layout.astro";
import BlogHeader from "../../components/BlogHeader.astro";
const { slug } = Astro.params; const { slug } = Astro.params;
@@ -27,10 +28,9 @@ const post = posts.objects[0];
</div> </div>
) : null ) : null
} }
<div style={{ display: "flex", justifyContent: "space-between" }}> <div>
<h4>{post.title}</h4> <BlogHeader title={post.title} date={post.published_at} />
<h5>{`🗓️ ${format(new Date(post.published_at), "MMM do, y")}`}</h5> <Markup content={post.content} />
</div> </div>
<Markup content={post.content} />
</article> </article>
</Layout> </Layout>
+17
View File
@@ -1,3 +1,20 @@
img { img {
border-radius: 5px; 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;
}
}