Skip to content

Commit

Permalink
feat: wiki first page
Browse files Browse the repository at this point in the history
Co-authored-by: DuckeyDev <[email protected]>
  • Loading branch information
Eveeifyeve and duckytutorials committed Jul 12, 2024
1 parent 3fb8da1 commit 710ccfd
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineCollection, z } from "astro:content";

const news = defineCollection({
type: "content",
type: 'content',
schema: z.object({
title: z.string(),
description: z.string(),
Expand All @@ -18,7 +18,7 @@ const news = defineCollection({
});

const wiki = defineCollection({
type: "content",
type: 'content',
schema: z.object({
title: z.string(),
}),
Expand Down
21 changes: 21 additions & 0 deletions src/content/wiki/players/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: "Getting Started"
---

## Prerequisites

Before you download and install, ensure that you have the latest version of Java installed on your machine.

## Download Links

#### Windows

For Windows, click [here](http://example.com/windows) to download.

#### MacOS

For MacOS, click [here](http://example.com/macos) to download.

#### Linux

For Linux, click [here](http://example.com/linux) to download.
29 changes: 0 additions & 29 deletions src/layouts/wiki.astro

This file was deleted.

29 changes: 29 additions & 0 deletions src/layouts/wikiContent.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
import Footer from "@component/footer.astro";
import Head from "@component/head.astro";
import Header from "@component/header.astro";
import { twMerge } from "tailwind-merge";
import "../styles/style.css";
export interface Props {
className?: string;
}
const { title } = Astro.props;
---

<Head
title={String(title) ?? "TeaClient Wiki Page"}
customDescription="This is the official documentation for TeaClient for both Players & Developers"
bannerPath="/assets/images/banner.png"
/>
<Header />
<div
class={twMerge(
`flex flex-col h-screen text-white my-[5%] mx-[5%] bg-[var(--nav-color)] rounded-lg`,
)}
>
<h1>{title}</h1>
<slot />
</div>
<Footer />
21 changes: 21 additions & 0 deletions src/pages/wiki/[...slug].astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
import { getCollection } from "astro:content";
import WikiContent from "../../layouts/wikiContent.astro";
import type { CollectionEntry } from "astro:content";
export async function getStaticPaths() {
const wikis = await getCollection("wiki");
return wikis.map((wiki) => ({
params: { slug: wiki.slug },
props: wiki,
}));
}
type Props = CollectionEntry<"wiki">;
const post = Astro.props;
const { Content } = await post.render();
---

<WikiContent {...post.data}>
<Content />
</WikiContent>
21 changes: 20 additions & 1 deletion src/pages/wiki/index.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
---
import Layout from "../../layouts/wiki.astro";
import { getCollection } from "astro:content";
import Layout from "../../layouts/layout.astro";
const wikiContent = await getCollection("wiki");
---

<Layout title="Home | TeaClent Wiki">
<h1>Welcome to TeaClent Wiki</h1>
<p>
This is the official documentation for TeaClent for both Players &
Developers
</p>
<section>
<ul>
{
wikiContent.map((page) => {
return (
<a href={`/wiki/${page.slug}/`}>
<h4 class="title">{page.data.title}</h4>
</a>
);
})
}
</ul>
</section>
</Layout>

0 comments on commit 710ccfd

Please sign in to comment.