before push commit
This commit is contained in:
parent
bd920f1731
commit
5217bba8f9
15 changed files with 125 additions and 59 deletions
|
@ -13,6 +13,7 @@
|
|||
"@tailwindcss/vite": "^4.0.13",
|
||||
"astro": "^5.4.3",
|
||||
"ava": "^6.2.0",
|
||||
"clsx": "^2.1.1",
|
||||
"luxon": "^3.5.0",
|
||||
"tailwindcss": "^4.0.13"
|
||||
},
|
||||
|
|
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
|
@ -17,6 +17,9 @@ importers:
|
|||
ava:
|
||||
specifier: ^6.2.0
|
||||
version: 6.2.0(rollup@4.35.0)
|
||||
clsx:
|
||||
specifier: ^2.1.1
|
||||
version: 2.1.1
|
||||
luxon:
|
||||
specifier: ^3.5.0
|
||||
version: 3.5.0
|
||||
|
|
|
@ -1,34 +1,31 @@
|
|||
---
|
||||
import Navigation from "./Navigation.astro";
|
||||
import conf from "~/site.config";
|
||||
import { isBlog } from "~/lib/metadata";
|
||||
|
||||
let headertext = conf.siteName;
|
||||
let headerurl = "/";
|
||||
let headerarrow = false;
|
||||
|
||||
function isBlog() {
|
||||
return Astro.url.pathname.startsWith("/blog");
|
||||
}
|
||||
|
||||
if (isBlog()) {
|
||||
headertext = "Everything And The Girl";
|
||||
headerurl = "/blog";
|
||||
headerarrow = true;
|
||||
if (isBlog(Astro.url.pathname)) {
|
||||
headertext = "Everything And The Girl";
|
||||
headerurl = "/blog";
|
||||
headerarrow = true;
|
||||
}
|
||||
---
|
||||
|
||||
<header class="md:flex md:justify-between md:items-center mb-4">
|
||||
<h1 class="text-2xl font-bold">
|
||||
{
|
||||
headerarrow && (
|
||||
<span class="mr-2">
|
||||
<a href="/">
|
||||
<i class="fa-solid fa-arrow-left text-light-pu dark:text-dark-pu" />
|
||||
</a>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
<a href={headerurl}>{headertext}</a>
|
||||
</h1>
|
||||
<Navigation />
|
||||
<h1 class="text-2xl font-bold">
|
||||
{
|
||||
headerarrow && (
|
||||
<span class="mr-2">
|
||||
<a href="/">
|
||||
<i class="fa-solid fa-arrow-left text-light-pu dark:text-dark-pu" />
|
||||
</a>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
<a href={headerurl}>{headertext}</a>
|
||||
</h1>
|
||||
<Navigation />
|
||||
</header>
|
||||
|
|
24
src/components/ui/Notif.astro
Normal file
24
src/components/ui/Notif.astro
Normal file
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
import { clsx } from "clsx";
|
||||
|
||||
interface Props {
|
||||
level: number;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
// level 0: info/note
|
||||
// level 1: warning
|
||||
// level 2: attn needed: oh fuck
|
||||
|
||||
const { level } = Astro.props;
|
||||
---
|
||||
|
||||
<div
|
||||
class={clsx("sm:block md:hidden text-black", {
|
||||
"bg-light-ye dark:bg-dark-ye": level === 0,
|
||||
"bg-light-or dark:bg-dark-or": level === 1,
|
||||
"bg-light-re dark:bg-dark-re": level === 2,
|
||||
})}
|
||||
>
|
||||
<slot />
|
||||
</div>
|
|
@ -1,3 +0,0 @@
|
|||
<div class="bg-light-ye dark:bg-dark-ye sm:block md:hidden text-black">
|
||||
<p>This view port may be too small.</p> <p>Try ivyneeds.rest on a bigger screen.</p>
|
||||
</div>
|
|
@ -9,12 +9,15 @@ const { title, description } = Astro.props;
|
|||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{titleConstructor(title)}</title>
|
||||
<title>{titleConstructor(title, Astro.url.pathname)}</title>
|
||||
<meta name="description" content={descriptionConstructor(description)} />
|
||||
<meta name="author" content="Ivy Turner" />
|
||||
|
||||
{/* og */}
|
||||
<meta property="og:title" content={titleConstructor(title)} />
|
||||
<meta
|
||||
property="og:title"
|
||||
content={titleConstructor(title, Astro.url.pathname)}
|
||||
/>
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://ivyneeds.rest" />
|
||||
<meta property="og:image" content="https://ivyneeds.rest/image.jpg" />
|
||||
|
@ -37,5 +40,5 @@ const { title, description } = Astro.props;
|
|||
<meta name="generator" content={Astro.generator} />
|
||||
|
||||
{/* clacks */}
|
||||
<meta http-equiv="X-Clacks-Overhead" content={`GNU ${getClacks()}`}>
|
||||
<meta http-equiv="X-Clacks-Overhead" content={`GNU ${getClacks()}`} />
|
||||
</head>
|
||||
|
|
8
src/components/util/SizeWarning.astro
Normal file
8
src/components/util/SizeWarning.astro
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
import Notif from "../ui/Notif.astro";
|
||||
---
|
||||
|
||||
<Notif level={1}>
|
||||
<p>This view port may be too small.</p>
|
||||
<p>Try ivyneeds.rest on a bigger screen.</p>
|
||||
</Notif>
|
6
src/content/blog/now1.md
Normal file
6
src/content/blog/now1.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
title: "/now: 2025-W13"
|
||||
description: "its now"
|
||||
date: 2025-03-24
|
||||
tags: now
|
||||
---
|
|
@ -2,7 +2,7 @@
|
|||
import "~/styles/global.css";
|
||||
import Head from "~/components/util/Head.astro";
|
||||
import { ClientRouter } from "astro:transitions";
|
||||
import SizeWarning from "~/components/ui/SizeWarning.astro";
|
||||
import SizeWarning from "~/components/util/SizeWarning.astro";
|
||||
|
||||
const { title, date, description } = Astro.props;
|
||||
---
|
||||
|
|
|
@ -3,21 +3,17 @@ import Base from "~/layouts/Base.astro";
|
|||
import Header from "~/components/ui/Header.astro";
|
||||
import Date from "~/components/util/Date.astro";
|
||||
import { noteTitleConstructor } from "~/lib/metadata";
|
||||
import StyledLink from "~/components/util/StyledLink.astro";
|
||||
const { title, exturl, icon, date } = Astro.props;
|
||||
---
|
||||
|
||||
<Base title={noteTitleConstructor(title, date)}>
|
||||
<Header />
|
||||
<ul class="fa-ul marker:text-accent">
|
||||
<li>
|
||||
<a href="/notes" class="link">
|
||||
<i class="fa-li fa-solid fa-arrow-left marker:text-accent" />
|
||||
Back to notes
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2 class="text-2xl font-bold mt-2">A note from <Date date={date} /></h2>
|
||||
<div class="bg-light-bg-2 dark:bg-dark-bg-2 p-4 rounded-lg w-fit min-w-[500px] mt-4">
|
||||
<div
|
||||
class="bg-light-bg-2 dark:bg-dark-bg-2 p-4 rounded-lg w-fit min-w-[500px] mt-4"
|
||||
>
|
||||
<ul class="fa-ul">
|
||||
{
|
||||
title && (
|
||||
|
@ -42,4 +38,8 @@ const { title, exturl, icon, date } = Astro.props;
|
|||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
<hr class="w-[500px]" />
|
||||
<StyledLink href="/notes" icon="fa-solid fa-arrow-left">
|
||||
See more notes
|
||||
</StyledLink>
|
||||
</Base>
|
||||
|
|
|
@ -1,18 +1,25 @@
|
|||
import conf from "~/site.config";
|
||||
// todo: add blog detection
|
||||
|
||||
export const titleConstructor = (title: string) => {
|
||||
console.log(title)
|
||||
if (!title) return conf.siteName;
|
||||
return `${title} | ${conf.siteName}`;
|
||||
export const isBlog = (pathname: string) => {
|
||||
return pathname.startsWith("/blog");
|
||||
};
|
||||
|
||||
export const titleConstructor = (title: string, pathname: string) => {
|
||||
if (isBlog(pathname)) {
|
||||
return title
|
||||
? `${title} | Everything And The Girl`
|
||||
: "Everything And The Girl";
|
||||
}
|
||||
if (!title) return conf.siteName;
|
||||
return `${title} | ${conf.siteName}`;
|
||||
};
|
||||
|
||||
export const descriptionConstructor = (description: string) => {
|
||||
if (!description) return conf.description;
|
||||
return `${description}`;
|
||||
if (!description) return conf.description;
|
||||
return `${description}`;
|
||||
};
|
||||
|
||||
export const noteTitleConstructor = (title: string, date: Date) => {
|
||||
if (title) return title;
|
||||
return `A note from ${date.toLocaleDateString()}`;
|
||||
if (title) return title;
|
||||
return `A note from ${date.toLocaleDateString()}`;
|
||||
};
|
|
@ -8,5 +8,6 @@ import BlogPostList from "~/components/lists/BlogPostList.astro";
|
|||
description="A list of all my blog posts."
|
||||
icon="fa-solid fa-blog"
|
||||
>
|
||||
|
||||
<BlogPostList collection="blog" />
|
||||
</Page>
|
||||
|
|
|
@ -8,7 +8,6 @@ import NoteList from "~/components/lists/NoteList.astro";
|
|||
import StyledLink from "~/components/util/StyledLink.astro";
|
||||
import { Content as Bio } from "~/content/bio.md";
|
||||
import Prose from "~/components/ui/Prose.astro";
|
||||
import { getClacks } from "~/lib/fun";
|
||||
---
|
||||
|
||||
<Layout>
|
||||
|
@ -21,13 +20,11 @@ import { getClacks } from "~/lib/fun";
|
|||
Hi! I'm Ivy, welcome to my website!
|
||||
</h1>
|
||||
|
||||
{getClacks()}
|
||||
|
||||
<Prose>
|
||||
<Bio />
|
||||
</Prose>
|
||||
|
||||
<div class="md:flex md:flex-column gap-2">
|
||||
<div class="md:flex md:flex-column gap-6">
|
||||
<Box title="latest blog posts" icon="fa-solid fa-blog">
|
||||
<CollectionList collection="blog" limit={5} />
|
||||
<hr class="h-px my-8 bg-light-pu dark:bg-dark-pu" />
|
||||
|
@ -40,5 +37,6 @@ import { getClacks } from "~/lib/fun";
|
|||
</Box>
|
||||
</div>
|
||||
</main>
|
||||
<Footer />
|
||||
</Layout>
|
||||
<Footer />
|
||||
|
||||
|
|
|
@ -1,15 +1,36 @@
|
|||
---
|
||||
import { getCollection } from "astro:content";
|
||||
import Page from "~/layouts/Page.astro";
|
||||
import { Content } from "~/content/now.md";
|
||||
import Prose from "~/components/ui/Prose.astro"
|
||||
// import { Content } from "~/content/now.md";
|
||||
import Prose from "~/components/ui/Prose.astro";
|
||||
|
||||
async function getLatestNowPost() {
|
||||
const allPosts = await getCollection("blog");
|
||||
const nowPosts = allPosts.filter(
|
||||
(post: { data: { tags?: string[] } }) =>
|
||||
post.data.tags && post.data.tags.includes("now")
|
||||
);
|
||||
return nowPosts[0]; // Return only the first post
|
||||
}
|
||||
|
||||
const latestPost = await getLatestNowPost(); // Fetch the first post at build time
|
||||
---
|
||||
|
||||
<Page title="/now" icon="fa-solid fa-calendar-days" date="2025-03-17">
|
||||
<Prose>
|
||||
<Content />
|
||||
</Prose>
|
||||
<p class="text-light-tx-2 dark:text-dark-tx-2 mt-2">
|
||||
This is a <a href="https://sive.rs/nowff">/now page</a> and
|
||||
<a href="https://nownownow.com/about">you should make one</a>, too.
|
||||
</p>
|
||||
<Prose>
|
||||
{
|
||||
latestPost ? (
|
||||
<div>
|
||||
<h2>{latestPost.data.title}</h2>
|
||||
<p>{latestPost.data.description}</p>
|
||||
</div>
|
||||
) : (
|
||||
<p>nae now</p>
|
||||
)
|
||||
}
|
||||
</Prose>
|
||||
</Page>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "astro/tsconfigs/strict",
|
||||
"include": [".astro/types.d.ts", "**/*"],
|
||||
"exclude": ["dist", "node_modules"],
|
||||
"exclude": ["dist", "node_modules", "cli"],
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue