code cleanup

make better use of props and layouts to cut down
on repeat boilerplate. correct typo in pets.md
description
This commit is contained in:
emma 2025-03-04 02:14:20 -05:00
parent 296cdd1d46
commit 7039f2b324
5 changed files with 76 additions and 115 deletions

View File

@ -13,8 +13,7 @@ const borderColorDark = "#474973";
const { frontmatter } = Astro.props;
---
<BasicLayout>
<h1>{frontmatter.title}</h1>
<BasicLayout pageTitle={frontmatter.title}>
<slot />
<div class="picrew-gallery">
<figure>

View File

@ -6,21 +6,8 @@ const pageTitle = "emma's interests - category";
const allPosts = Object.values(import.meta.glob('./entries/*.md', {eager: true}));
---
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{pageTitle}</title>
</head>
<body>
<BasicLayout>
<h1>{pageTitle}</h1>
<BasicLayout pageTitle={pageTitle}>
<ul>
{allPosts.map((post: any) => <CategoryPage url={post.url} title={post.frontmatter.title} description={post.frontmatter.description}/>)}
</ul>
</BasicLayout>
</body>
</html>
</BasicLayout>

View File

@ -2,5 +2,5 @@
layout: ../../../../layouts/MarkdownLayout.astro
title: emma's pets
description: "i've had pets all throughout my life. they are a core part of who i am. i've learn so much about animals and myself in the process. you can read about some of them here"
description: "i've had pets all throughout my life. they are a core part of who i am. i've learned so much about animals and myself in the process. you can read about some of them here"
---

View File

@ -5,21 +5,8 @@ const pageTitle = "emma's rays of sunshine - category";
const allPosts = Object.values(import.meta.glob('./entries/*.md', {eager: true}));
---
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{pageTitle}</title>
</head>
<body>
<BasicLayout>
<h1>{pageTitle}</h1>
<BasicLayout pageTitle={pageTitle}>
<ul>
{allPosts.map((post: any) => <CategoryPage url={post.url} title={post.frontmatter.title} description={post.frontmatter.description}/>)}
</ul>
</BasicLayout>
</body>
</html>
</BasicLayout>

View File

@ -2,14 +2,36 @@
import BasicLayout from "../../layouts/BasicLayout.astro";
const pageTitle = "emma's guestbook"
---
<BasicLayout pageTitle={pageTitle}>
<p>
hey, just a little heads up. i'm redoing a lot of my site right now.
i made this guestbook in a bit of a hurry so some helpful things like
letting you know i got your post and will approve it aren't there just yet.
but you are welcome to sign it and i'll check every few days to approve entries
until i get around to adding a bit more friendliness to parts of this guestbook
</p>
<form id="add-comment">
<label for="name-input">name: <input type="text" id="name-input" name="name-input" required></label>
<label for="website-input">website (optional): <input type="text" name="website-input" id="website-input"></label>
<label for="math-question">what is seven plus 10: <input type="number" name="math-question" id="math-question" required></label>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{pageTitle}</title>
<style>
<label for="message-input">message: </label>
<textarea required name="message-input" id="message-input" rows="8" cols=55"></textarea>
<button type="submit">send message</button>
</form>
<h3>comments</h3>
<ul class="comments">
</ul>
<script>
import "../../scripts/guestbook-send-comment"
</script>
<script>
import "../../scripts/guestbook-list-comments"
</script>
</BasicLayout>
<style>
p {
margin-bottom: 0.75rem;
}
@ -51,38 +73,4 @@ const pageTitle = "emma's guestbook"
margin-left: 0.6rem;
padding: 0.25rem;
}
</style>
</head>
<body>
<BasicLayout>
<h1>{pageTitle}</h1>
<p>
hey, just a little heads up. i'm redoing a lot of my site right now.
i made this guestbook in a bit of a hurry so some helpful things like
letting you know i got your post and will approve it aren't there just yet.
but you are welcome to sign it and i'll check every few days to approve entries
until i get around to adding a bit more friendliness to parts of this guestbook
</p>
<form id="add-comment">
<label for="name-input">name: <input type="text" id="name-input" name="name-input" required></label>
<label for="website-input">website (optional): <input type="text" name="website-input" id="website-input"></label>
<label for="math-question">what is seven plus 10: <input type="number" name="math-question" id="math-question" required></label>
<label for="message-input">message: </label>
<textarea required name="message-input" id="message-input" rows="8" cols=55"></textarea>
<button type="submit">send message</button>
</form>
<h3>comments</h3>
<ul class="comments">
</ul>
<script>
import "../../scripts/guestbook-send-comment"
</script>
<script>
import "../../scripts/guestbook-list-comments"
</script>
</BasicLayout>
</body>
</html>
</style>