Some basic styling on the blog index
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
const today = new Date();
|
||||
---
|
||||
|
||||
<footer class="py-4 text-sm text-center bg-dark text-light">
|
||||
<footer
|
||||
class="py-4 text-sm text-center bg-dark text-light absolute bottom-0 w-full"
|
||||
>
|
||||
© {today.getFullYear()} Terakoda, LLC. All rights reserved.
|
||||
</footer>
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
---
|
||||
interface Props {
|
||||
date: Date;
|
||||
date: Date;
|
||||
}
|
||||
|
||||
const { date } = Astro.props;
|
||||
---
|
||||
|
||||
<time datetime={date.toISOString()}>
|
||||
{
|
||||
date.toLocaleDateString('en-us', {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
})
|
||||
}
|
||||
{
|
||||
// date.toLocaleDateString('en-us', {
|
||||
// year: 'numeric',
|
||||
// month: 'short',
|
||||
// day: 'numeric',
|
||||
// })
|
||||
date.toISOString()
|
||||
}
|
||||
</time>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
---
|
||||
import HeaderLink from "./HeaderLink.astro";
|
||||
import { Picture, Image } from "astro:assets";
|
||||
import HeaderLogo from "../assets/HeaderLogo.png";
|
||||
---
|
||||
|
||||
|
||||
@@ -1,135 +1,54 @@
|
||||
---
|
||||
import BaseHead from '../../components/BaseHead.astro';
|
||||
import Header from '../../components/Header.astro';
|
||||
import Footer from '../../components/Footer.astro';
|
||||
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
|
||||
import { getCollection } from 'astro:content';
|
||||
import FormattedDate from '../../components/FormattedDate.astro';
|
||||
import BaseHead from "../../components/BaseHead.astro";
|
||||
import Header from "../../components/Header.astro";
|
||||
import Footer from "../../components/Footer.astro";
|
||||
import { SITE_TITLE, SITE_DESCRIPTION } from "../../consts";
|
||||
import { getCollection } from "astro:content";
|
||||
import FormattedDate from "../../components/FormattedDate.astro";
|
||||
|
||||
const posts = (await getCollection('blog')).sort(
|
||||
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
|
||||
const posts = (await getCollection("blog")).sort(
|
||||
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
|
||||
);
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
|
||||
<style>
|
||||
main {
|
||||
width: 960px;
|
||||
}
|
||||
ul {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 2rem;
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
ul li {
|
||||
width: calc(50% - 1rem);
|
||||
}
|
||||
ul li * {
|
||||
text-decoration: none;
|
||||
transition: 0.2s ease;
|
||||
}
|
||||
ul li:first-child {
|
||||
width: 100%;
|
||||
margin-bottom: 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
ul li:first-child img {
|
||||
width: 100%;
|
||||
}
|
||||
ul li:first-child .title {
|
||||
font-size: 2.369rem;
|
||||
}
|
||||
ul li img {
|
||||
margin-bottom: 0.5rem;
|
||||
border-radius: 12px;
|
||||
}
|
||||
ul li a {
|
||||
display: block;
|
||||
}
|
||||
.title {
|
||||
margin: 0;
|
||||
color: rgb(var(--black));
|
||||
line-height: 1;
|
||||
}
|
||||
.date {
|
||||
margin: 0;
|
||||
color: rgb(var(--gray));
|
||||
}
|
||||
ul li a:hover h4,
|
||||
ul li a:hover .date {
|
||||
color: rgb(var(--accent));
|
||||
}
|
||||
ul a:hover img {
|
||||
box-shadow: var(--box-shadow);
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
ul {
|
||||
gap: 0.5em;
|
||||
}
|
||||
ul li {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
ul li:first-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
ul li:first-child .title {
|
||||
font-size: 1.563em;
|
||||
}
|
||||
}
|
||||
|
||||
.post {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: top;
|
||||
gap: 0.5em;
|
||||
}
|
||||
|
||||
.post-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 0.5em;
|
||||
}
|
||||
|
||||
.post-image img {
|
||||
max-height: 200px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<Header />
|
||||
<main>
|
||||
<section>
|
||||
<ul>
|
||||
{
|
||||
posts.map((post) => (
|
||||
<li>
|
||||
<a href={`/blog/${post.id}/`}>
|
||||
<div class="post">
|
||||
<div class="post-image">
|
||||
<img width={200} height={200} src={post.data.heroImage} alt="" />
|
||||
<head>
|
||||
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
|
||||
</head>
|
||||
<body class="relative min-h-dvh">
|
||||
<Header />
|
||||
<main>
|
||||
<section class="max-w-200 m-auto my-16">
|
||||
<ul>
|
||||
{
|
||||
posts.map((post) => (
|
||||
<li class="border-t-2 border-medium p-4 first:border-0">
|
||||
<a href={`/blog/${post.id}/`}>
|
||||
<div class="flex flex-row gap-4">
|
||||
<div class="flex-none">
|
||||
<img
|
||||
width={200}
|
||||
height={200}
|
||||
src={post.data.heroImage}
|
||||
alt=""
|
||||
/>
|
||||
</div>
|
||||
<div class="post-text">
|
||||
<p class="date">
|
||||
<div>
|
||||
<p class="text-medium">
|
||||
<FormattedDate date={post.data.pubDate} />
|
||||
</p>
|
||||
<h4 class="title">{post.data.title}</h4>
|
||||
<h4 class="text-xl font-bold">{post.data.title}</h4>
|
||||
<p>{post.data.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</section>
|
||||
</main>
|
||||
<Footer />
|
||||
</body>
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</section>
|
||||
</main>
|
||||
<Footer />
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -12,7 +12,7 @@ import HeaderLogo from "../assets/HeaderLogo.png";
|
||||
<head>
|
||||
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
|
||||
</head>
|
||||
<body>
|
||||
<body class="relative min-h-dvh">
|
||||
<Header />
|
||||
<div class="bg-dark text-light py-16">
|
||||
<div class="flex flex-col items-center gap-8 w-200 m-auto">
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
--color-primary: rgb(46, 182, 112);
|
||||
--color-primary-dark: #269e61;
|
||||
--color-light: #fdfafc;
|
||||
/* Mix light and dark using the perceptually uniform oklab color space */
|
||||
--color-medium: color-mix(in oklab, var(--color-light), var(--color-dark));
|
||||
--color-dark: #1f2932;
|
||||
--color-light-accent: #f9f7f7; /* Slightly darker light background for contrast */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user