-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76de18e
commit b2dfbdc
Showing
10 changed files
with
182 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { defineCollection, z } from "astro:content"; | ||
import { i18nCollection, i18nSchema } from "../schemas/i18n"; | ||
import { blogCollection } from "../schemas/blog"; | ||
import { showcaseCollection } from "../schemas/showcase"; | ||
|
||
|
||
export const collections = { | ||
blog: blogCollection(), | ||
showcase: showcaseCollection(), | ||
// i18n: i18nCollection(), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
hide: production | ||
title: Material 3 for Solid | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
import type { GetStaticPaths } from 'astro'; | ||
import { getCollection, type CollectionEntry } from 'astro:content'; | ||
import dayjs from 'dayjs'; | ||
import Page from '../../layouts/Page.astro'; | ||
import { Header } from '../../components/header'; | ||
import { Footer } from '../../components/footer'; | ||
import Markdown from '../../components/markdown/Markdown.astro'; | ||
import { getShowcaseCollection } from '../../schemas/showcase'; | ||
export const getStaticPaths: GetStaticPaths = async () => { | ||
const entries = await getShowcaseCollection(); | ||
return entries.map(entry => ({ | ||
params: { | ||
slug: entry.slug, | ||
}, | ||
props: entry, | ||
})); | ||
} | ||
type Props = CollectionEntry<"showcase">; | ||
const entry = Astro.props; | ||
const { Content } = await entry.render(); | ||
--- | ||
|
||
<Page> | ||
<Header /> | ||
<main> | ||
<Markdown> | ||
<Content /> | ||
</Markdown> | ||
</main> | ||
<Footer /> | ||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { defineCollection, getCollection, z, type SchemaContext } from "astro:content"; | ||
import { imageSchema } from "./utils"; | ||
|
||
export const showcaseCollection = () => | ||
defineCollection({ | ||
type: "content", | ||
schema: showcaseSchema, | ||
}); | ||
|
||
export const showcaseSchema = (context: SchemaContext) => { | ||
return z.object({ | ||
hide: z.enum(["development", "production"]).optional(), | ||
title: z.string(), | ||
description: z.string().optional(), | ||
cover: imageSchema(context).optional(), | ||
}); | ||
} | ||
|
||
export const getShowcaseCollection = async () => { | ||
let entries = await getCollection("showcase"); | ||
if(import.meta.env.PROD) { | ||
entries = entries.filter(entry => entry.data.hide !== "production"); | ||
} | ||
if(import.meta.env.DEV) { | ||
entries = entries.filter(entry => entry.data.hide !== "development"); | ||
} | ||
return entries; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters