Skip to content

Commit

Permalink
Ryuuart/issue210 (#213)
Browse files Browse the repository at this point in the history
* Migrate home realm list to use content collections

* Update hyperpink to use content collections

* Migrate realm pages and polish
  • Loading branch information
ryuuart authored Aug 30, 2023
1 parent 622db47 commit 21dbf43
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 121 deletions.
92 changes: 0 additions & 92 deletions web/data/realms.json

This file was deleted.

3 changes: 2 additions & 1 deletion web/public/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ a:visited {
color: unset;
}

span.japanese {
span.japanese,
[lang="ja"] {
font-family: serif;
font-style: normal;
}
11 changes: 11 additions & 0 deletions web/src/components/home/realms/RealmItem.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
---
interface Props {
title: string;
tagline: string;
url: string;
color: string;
author: {
name: string;
link: string;
};
}
const { title, tagline, url, color, author } = Astro.props;
---

Expand Down
33 changes: 18 additions & 15 deletions web/src/components/home/realms/Realms.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
import { getCollection, getEntry } from "astro:content";
import Section from "../../../layouts/home/Section.astro";
import realmsData from "../../../../data/realms.json";
import RealmItem from "./RealmItem.astro";
let allRealms = await getCollection("realms");
---

<Section class="realms">
Expand All @@ -20,20 +22,21 @@ import RealmItem from "./RealmItem.astro";
</header>
<ul>
{
Object.values(realmsData).map(
(i) =>
!i.draft && (
<li>
<RealmItem
title={i.title}
tagline={i.tagline}
url={i.url}
color={i.color.portal}
author={i.author}
/>
</li>
)
)
allRealms.map(async (realm) => {
const author = await getEntry(realm.data.author);

return (
<li>
<RealmItem
title={realm.data.title}
tagline={realm.data.tagline}
url={`/realms/${realm.slug}`}
color={realm.data.color.portal}
author={author.data}
/>
</li>
);
})
}
</ul>
</Section>
Expand Down
13 changes: 7 additions & 6 deletions web/src/components/realms/Story.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
interface Props {
story: string;
song: {
link: string;
name: string;
Expand All @@ -11,15 +10,13 @@ interface Props {
};
}
const { story, song, author } = Astro.props;
const { song, author } = Astro.props;
---

<article>
<div class="story-container">
<h2>Story</h2>
<p>
{story}
</p>
<slot />
</div>
<div class="metadata-container">
<div class="author-container">
Expand Down Expand Up @@ -58,7 +55,7 @@ const { story, song, author } = Astro.props;
margin-bottom: 0.25rem;
}

.story-container p {
.story-container :global(p) {
margin-bottom: 1rem;

font-family: "PP Migra", serif;
Expand All @@ -83,6 +80,10 @@ const { story, song, author } = Astro.props;
flex: 1 0 auto;
}

.song-container {
font-family: "Crimson Pro", serif;
}

@media screen and (min-width: 768px) {
article {
grid-template-columns: auto auto;
Expand Down
4 changes: 4 additions & 0 deletions web/src/content/authors/ryuuart.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "ryuuart",
"link": "https://www.long-nguyen.dev/"
}
24 changes: 23 additions & 1 deletion web/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
// src/content/config.ts
import { defineCollection } from "astro:content";
import { defineCollection, reference, z } from "astro:content";
import { docsSchema } from "@astrojs/starlight/schema";

export const collections = {
docs: defineCollection({ schema: docsSchema() }),
realms: defineCollection({
type: "content",
schema: z.object({
title: z.string(),
tagline: z.string(),
author: reference("authors"),
song: z.object({
name: z.string(),
link: z.string().url(),
}),
color: z.object({
portal: z.string(),
}),
}),
}),
authors: defineCollection({
type: "data",
schema: z.object({
name: z.string(),
link: z.string().url(),
}),
}),
};
7 changes: 7 additions & 0 deletions web/src/content/realms/_flarewater.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: flarewater
tagline: elemental flavor
author: ryuuart
color:
portal: firebrick
---
7 changes: 7 additions & 0 deletions web/src/content/realms/_hero.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Hero
tagline: another self
author: ryuuart
color:
portal: gold
---
12 changes: 12 additions & 0 deletions web/src/content/realms/hyperpink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: hyperpink
tagline: prima donna
author: ryuuart
song:
name: Dialtone
link: https://www.youtube.com/watch?v=Z-IarCz4GKw
color:
portal: hotpink
---

**HYPERPINK** is inspired by my queer friends and myself. They thought it would be so cool if the marquee was interactive so here it is. We are queening here rn!!
12 changes: 12 additions & 0 deletions web/src/content/realms/hypertrance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "#HYPERTRANCE"
tagline: infinite evolution —
author: ryuuart
song:
name: Infinite Evolution
link: https://open.spotify.com/track/39VB77jY5WTMFEH6TwUb6s?si=a6bff74890284ed2
color:
portal: royalblue
---

**#HYPERTRANCE** is the sound and aesthetic of **MANAWAVE**. It’s directly inspired from the y2k cyber era of look and sound. I feel spiritually aligned to its feeling as someone nostalgic for more imaginative times.
12 changes: 12 additions & 0 deletions web/src/content/realms/senbonzakura.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Senbonzakura
tagline: dreaming 1000 cherry blossoms
author: ryuuart
song:
name: 感情の魔天楼 ~ World's End
link: https://www.youtube.com/watch?v=N1w4T9G9g7M
color:
portal: deeppink
---

**SENBONZAKURA** <span class="japanese">(千本桜)</span> came to me while listening to TOUHOU music at the gym. Feeling the passion, I suddenly saw a field of moonlit typographic cherry petals.
14 changes: 10 additions & 4 deletions web/src/layouts/realms/Realm.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import Layout from "../Layout.astro";
import Header from "../../components/realms/Header.astro";
import realmData from "../../../data/realms.json";
import Aura from "../../components/realms/Aura.astro";
import Story from "../../components/realms/Story.astro";
import { getEntry, type CollectionEntry } from "astro:content";
export type RealmLayoutConfig = {
colors?: {
Expand All @@ -14,12 +14,16 @@ export type RealmLayoutConfig = {
interface Props {
pageTitle: string;
realm: keyof typeof realmData;
realm: CollectionEntry<"realms">["slug"];
config?: RealmLayoutConfig;
}
const { pageTitle, realm, config } = Astro.props;
const { title, tagline, story, song, color, author } = realmData[realm];
const realmData = await getEntry("realms", realm);
const { title, tagline, song, color } = realmData.data;
const author = (await getEntry(realmData.data.author)).data;
const { Content } = await realmData.render();
---

<Layout title={pageTitle} tabcolor={config?.colors?.tab ?? "black"}>
Expand All @@ -29,7 +33,9 @@ const { title, tagline, story, song, color, author } = realmData[realm];
<a href="/">return</a>
</div>
<Header title={title} tagline={tagline} />
<Story story={story} song={song} author={author} />
<Story song={song} author={author}>
<Content />
</Story>
<section>
<div>
<slot />
Expand Down
6 changes: 4 additions & 2 deletions web/src/pages/realms/hyperpink.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
import { getEntry } from "astro:content";
import Realm from "../../layouts/realms/Realm.astro";
import realmData from "../../../data/realms.json";
const realmData = await getEntry("realms", "hyperpink");
---

<Realm
Expand Down Expand Up @@ -60,7 +62,7 @@ import realmData from "../../../data/realms.json";
}
</style>

<style define:vars={{ "color-aura": realmData["hyperpink"].color.portal }}>
<style define:vars={{ "color-aura": realmData.data.color.portal }}>
/* Element, general styles*/
h2,
h3 {
Expand Down

0 comments on commit 21dbf43

Please sign in to comment.