LoL rulepage, needs work.

This commit is contained in:
Rene Arumetsa
2025-08-09 02:11:51 +03:00
parent 2eb4bb9a6a
commit e85e0f0445
4 changed files with 1445 additions and 7 deletions

View File

@@ -0,0 +1,35 @@
// filepath: /home/renkar/Dokumendid/Projects/tipilan/src/app/reeglid/[slug]/page.tsx
import fs from "node:fs/promises";
import path from "node:path";
import matter from "gray-matter";
import ReactMarkdown from "react-markdown";
type Props = { params: { slug: string } };
export default async function RulePage({ params }: Props) {
const filePath = path.join(process.cwd(), "src/data/rules", `${params.slug}.md`);
let file;
try {
file = await fs.readFile(filePath, "utf8");
} catch (e) {
return <div className="text-red-500">Reegleid ei leitud.</div>;
}
const { content, data } = matter(file);
return (
<div className="prose mx-auto my-16 ml-8">
<h1>{data.title || params.slug.toUpperCase() + " REEGLID"}</h1>
<ReactMarkdown
components={{
h1: ({node, ...props}) => <h1 className="font-bold" {...props} />,
h2: ({node, ...props}) => <h2 className="font-bold" {...props} />,
h3: ({node, ...props}) => <h3 className="font-bold" {...props} />,
h4: ({node, ...props}) => <h4 className="font-bold" {...props} />,
h5: ({node, ...props}) => <h5 className="font-bold" {...props} />,
h6: ({node, ...props}) => <h6 className="font-bold" {...props} />,
}}
>
{content}
</ReactMarkdown>
</div>
);

View File

@@ -41,7 +41,7 @@ export default function Tourney() {
</p>
<br />
<div className={"flex flex-row flex-wrap gap-8"}>
<Link href="/kodukord" target="_blank">
<Link href="/reeglid/cs2" target="_blank">
<button
className={`px-4 py-2 bg-[#1F5673] cursor-pointer ${vipnagorgialla.className} font-bold italic`}
>
@@ -83,7 +83,7 @@ export default function Tourney() {
</p>
<br />
<div className="flex flex-row flex-wrap gap-8 justify-end">
<Link href="/kodukord" target="_blank">
<Link href="/reeglid/lol" target="_blank">
<button
className={`px-4 py-2 bg-[#1F5673] cursor-pointer ${vipnagorgialla.className} font-bold italic`}
>