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; const { frontmatter } = Astro.props;
--- ---
<BasicLayout> <BasicLayout pageTitle={frontmatter.title}>
<h1>{frontmatter.title}</h1>
<slot /> <slot />
<div class="picrew-gallery"> <div class="picrew-gallery">
<figure> <figure>

View File

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

View File

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

View File

@ -2,87 +2,75 @@
import BasicLayout from "../../layouts/BasicLayout.astro"; import BasicLayout from "../../layouts/BasicLayout.astro";
const pageTitle = "emma's guestbook" 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"> <label for="message-input">message: </label>
<head> <textarea required name="message-input" id="message-input" rows="8" cols=55"></textarea>
<meta charset="utf-8" /> <button type="submit">send message</button>
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> </form>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{pageTitle}</title>
<style>
p {
margin-bottom: 0.75rem;
}
form {
display: flex;
flex-direction: column;
align-items: flex-start;
padding-left: 0.5rem;
width: 40vw;
height: auto;
}
label {
padding-bottom: 0.5rem;
}
#name-input {
margin-left: 8.88rem;
width: 15rem;
}
#website-input { <h3>comments</h3>
width: 15rem; <ul class="comments">
margin-left: 1.8rem; </ul>
} <script>
import "../../scripts/guestbook-send-comment"
</script>
<script>
import "../../scripts/guestbook-list-comments"
</script>
</BasicLayout>
#message-input { <style>
margin-left: 0.6rem; p {
} margin-bottom: 0.75rem;
}
form {
display: flex;
flex-direction: column;
align-items: flex-start;
padding-left: 0.5rem;
width: 40vw;
height: auto;
}
label {
padding-bottom: 0.5rem;
}
#name-input {
margin-left: 8.88rem;
width: 15rem;
}
#math-question { #website-input {
margin-left: 4.5rem; width: 15rem;
} margin-left: 1.8rem;
}
textarea { #message-input {
resize: none; margin-left: 0.6rem;
margin-bottom: 0.25rem; }
}
button { #math-question {
margin-left: 0.6rem; margin-left: 4.5rem;
padding: 0.25rem; }
}
</style>
</head>
<body> textarea {
<BasicLayout> resize: none;
<h1>{pageTitle}</h1> margin-bottom: 0.25rem;
<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> button {
<textarea required name="message-input" id="message-input" rows="8" cols=55"></textarea> margin-left: 0.6rem;
<button type="submit">send message</button> padding: 0.25rem;
</form> }
</style>
<h3>comments</h3>
<ul class="comments">
</ul>
<script>
import "../../scripts/guestbook-send-comment"
</script>
<script>
import "../../scripts/guestbook-list-comments"
</script>
</BasicLayout>
</body>
</html>