You've already forked zblade.dev
cb77a5e7d8
Add global CSS rules for markdown tables in BlogPost.astro including borders, padding, and row hover states. Update the token savings breakdown table to use an improved format with visual impact scales.
228 lines
5.0 KiB
Plaintext
228 lines
5.0 KiB
Plaintext
---
|
|
import type { CollectionEntry } from 'astro:content';
|
|
import BaseLayout from './BaseLayout.astro';
|
|
|
|
interface Props {
|
|
post: CollectionEntry<'blog'>;
|
|
}
|
|
|
|
const { post } = Astro.props;
|
|
---
|
|
|
|
<BaseLayout title={post.data.title} description={post.data.description}>
|
|
<main>
|
|
<article class="blog-post">
|
|
{post.data.heroImage && (
|
|
<div class="hero-image">
|
|
<img src={post.data.heroImage} alt="" />
|
|
</div>
|
|
)}
|
|
|
|
<div class="post-container">
|
|
<header class="post-header">
|
|
<div class="post-meta">
|
|
<time datetime={post.data.pubDate.toISOString()}>
|
|
{post.data.pubDate.toLocaleDateString('en-US', {
|
|
year: 'numeric',
|
|
month: 'long',
|
|
day: 'numeric',
|
|
})}
|
|
</time>
|
|
{post.data.categories.length > 0 && (
|
|
<span class="categories">
|
|
{post.data.categories.join(', ')}
|
|
</span>
|
|
)}
|
|
</div>
|
|
<h1 class="post-title">{post.data.title}</h1>
|
|
<p class="post-description">{post.data.description}</p>
|
|
{post.data.tags.length > 0 && (
|
|
<div class="tags">
|
|
{post.data.tags.map((tag) => <span class="tag">#{tag}</span>)}
|
|
</div>
|
|
)}
|
|
</header>
|
|
|
|
<div class="post-content">
|
|
<slot />
|
|
</div>
|
|
</div>
|
|
</article>
|
|
</main>
|
|
</BaseLayout>
|
|
|
|
<style>
|
|
.blog-post {
|
|
padding-top: 60px;
|
|
}
|
|
|
|
.hero-image {
|
|
width: 100%;
|
|
max-height: 400px;
|
|
overflow: hidden;
|
|
margin-bottom: var(--space-xl);
|
|
}
|
|
|
|
.hero-image img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.post-container {
|
|
max-width: 720px;
|
|
margin: 0 auto;
|
|
padding: 0 var(--space-md);
|
|
padding-bottom: var(--space-2xl);
|
|
}
|
|
|
|
.post-header {
|
|
margin-bottom: var(--space-xl);
|
|
text-align: center;
|
|
}
|
|
|
|
.post-meta {
|
|
display: flex;
|
|
justify-content: center;
|
|
gap: var(--space-md);
|
|
font-family: var(--font-mono);
|
|
font-size: 0.875rem;
|
|
color: var(--color-text-secondary);
|
|
margin-bottom: var(--space-md);
|
|
}
|
|
|
|
.categories {
|
|
color: var(--color-accent);
|
|
}
|
|
|
|
.post-title {
|
|
font-size: clamp(2rem, 5vw, 3rem);
|
|
font-weight: 900;
|
|
line-height: 1.1;
|
|
margin-bottom: var(--space-md);
|
|
color: var(--color-text);
|
|
}
|
|
|
|
.post-description {
|
|
font-size: 1.125rem;
|
|
color: var(--color-text-secondary);
|
|
line-height: 1.6;
|
|
margin-bottom: var(--space-md);
|
|
}
|
|
|
|
.tags {
|
|
display: flex;
|
|
justify-content: center;
|
|
gap: var(--space-sm);
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.tag {
|
|
font-family: var(--font-mono);
|
|
font-size: 0.75rem;
|
|
color: var(--color-accent);
|
|
background: var(--color-bg-elevated);
|
|
padding: 0.25rem 0.5rem;
|
|
border-radius: var(--radius-sm);
|
|
}
|
|
|
|
.post-content {
|
|
font-size: 1.0625rem;
|
|
line-height: 1.75;
|
|
color: var(--color-text-secondary);
|
|
}
|
|
|
|
.post-content :global(h2) {
|
|
font-size: 1.5rem;
|
|
font-weight: 700;
|
|
color: var(--color-text);
|
|
margin-top: var(--space-xl);
|
|
margin-bottom: var(--space-md);
|
|
}
|
|
|
|
.post-content :global(h3) {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
color: var(--color-text);
|
|
margin-top: var(--space-lg);
|
|
margin-bottom: var(--space-sm);
|
|
}
|
|
|
|
.post-content :global(p) {
|
|
margin-bottom: var(--space-md);
|
|
}
|
|
|
|
.post-content :global(a) {
|
|
color: var(--color-accent);
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.post-content :global(code) {
|
|
font-family: var(--font-mono);
|
|
background: var(--color-bg-elevated);
|
|
padding: 0.2rem 0.4rem;
|
|
border-radius: var(--radius-sm);
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
.post-content :global(pre) {
|
|
background: var(--color-bg-elevated);
|
|
padding: var(--space-md);
|
|
border-radius: var(--radius-md);
|
|
overflow-x: auto;
|
|
margin-bottom: var(--space-md);
|
|
}
|
|
|
|
.post-content :global(pre code) {
|
|
background: none;
|
|
padding: 0;
|
|
}
|
|
|
|
.post-content :global(ul),
|
|
.post-content :global(ol) {
|
|
margin-bottom: var(--space-md);
|
|
padding-left: var(--space-lg);
|
|
}
|
|
|
|
.post-content :global(li) {
|
|
margin-bottom: var(--space-xs);
|
|
}
|
|
|
|
.post-content :global(blockquote) {
|
|
border-left: 3px solid var(--color-accent);
|
|
padding-left: var(--space-md);
|
|
margin: var(--space-md) 0;
|
|
color: var(--color-text-secondary);
|
|
font-style: italic;
|
|
}
|
|
|
|
.post-content :global(table) {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin: var(--space-xl) 0;
|
|
font-size: 0.95rem;
|
|
font-family: var(--font-mono);
|
|
}
|
|
|
|
.post-content :global(th) {
|
|
text-align: left;
|
|
padding: var(--space-sm) var(--space-md);
|
|
border-bottom: 2px solid var(--color-border);
|
|
color: var(--color-text);
|
|
font-weight: 600;
|
|
}
|
|
|
|
.post-content :global(td) {
|
|
padding: var(--space-sm) var(--space-md);
|
|
border-bottom: 1px solid var(--color-border);
|
|
color: var(--color-text-secondary);
|
|
}
|
|
|
|
.post-content :global(tr:last-child td) {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.post-content :global(tr:hover td) {
|
|
background: var(--color-bg-elevated);
|
|
}
|
|
</style> |