split config.json intro seperate files

This commit is contained in:
2022-12-11 15:44:34 +01:00
parent d77eaa7b4a
commit cd602201cb
7 changed files with 98 additions and 106 deletions

View File

@@ -2,7 +2,7 @@ import styles from "./Navigation.module.scss";
import { GractwoLogo } from "../Logo"; import { GractwoLogo } from "../Logo";
import Link from "next/link"; import Link from "next/link";
import config from "../../data/config.json"; import navigation from "../../data/navigation.json";
const Navigation = () => { const Navigation = () => {
let username: string = ""; let username: string = "";
@@ -10,7 +10,7 @@ const Navigation = () => {
<> <>
<div className={styles.nav}> <div className={styles.nav}>
<GractwoLogo className={`${styles.logo} ${styles.desktop}`} /> <GractwoLogo className={`${styles.logo} ${styles.desktop}`} />
{config.navigation.map((navlink) => { {navigation.map((navlink) => {
return ( return (
<Link <Link
key={`desktop${navlink.href}`} key={`desktop${navlink.href}`}
@@ -26,7 +26,7 @@ const Navigation = () => {
nawigacja nawigacja
{/* TUTAJ WSTAWIĆ IKONKĘ PÓŹNIEJ */} {/* TUTAJ WSTAWIĆ IKONKĘ PÓŹNIEJ */}
<div className={styles.innerdropdown}> <div className={styles.innerdropdown}>
{config.navigation.map((navlink) => { {navigation.map((navlink) => {
return ( return (
<Link <Link
key={`mobile${navlink.href}`} key={`mobile${navlink.href}`}

View File

@@ -1,98 +0,0 @@
{
"splashes": [
{
"body": "ona jest narysowana debilu",
"author": "jamesen"
},
{
"body": "idą jak surykatki na śmierć puszczone",
"author": "mollin"
},
{
"body": "jak spotkam stacha będziemy się napierdalać",
"author": "KuOlek"
},
{
"body": "to nie kwestia fetyszu, to kwestia prawa izraela",
"author": "stachowiak"
},
{
"body": "czemu ten szkielet ma oczy i czilluje",
"author": "stachowiak"
},
{
"body": "decymalizacja człowieka",
"author": "elephant / suoń"
},
{
"body": "pizdeczka... z całym szacunkiem",
"author": "bavil gravlax"
},
{
"body": "mam dwunastometrowego kija w dupie",
"author": "stachowiak"
},
{
"body": "pamięć wody o jabłku",
"author": "maciuś"
},
{
"body": "właśnie piszę biblię",
"author": "elephant / suoń"
},
{
"body": "bitwa o chromosom",
"author": "mollin"
}
],
"navigation": [
{
"name": "główna",
"href": "/"
},
{
"name": "o gractwie",
"href": "/o-gractwie"
},
{
"name": "cytaty",
"href": "/cytaty"
},
{
"name": "rankingi",
"href": "/rankingi"
}
],
"links": [
{
"name": "Discord",
"href": "https://discord.gg/NBXq95C",
"hrefalias": ["/discord", "/dsc", "/dc"],
"desc": "Nasz serwer na Discordzie!"
},
{
"name": "YouTube",
"href": "https://www.youtube.com/@gractwopl",
"hrefalias": ["/youtube", "/yt"],
"desc": "Nasz kanał na YouTubie!"
},
{
"name": "Twitter",
"href": "https://twitter.com/gractwo",
"hrefalias": ["/twitter", "/twt"],
"desc": "Nasz profil na Twitterze!"
},
{
"name": "GitHub",
"href": "https://github.com/gractwo",
"hrefalias": ["/github", "/gh"],
"desc": "Nasz org na GitHubie!"
},
{
"name": "Kod Źródłowy",
"href": "https://github.com/gractwo/gractwo-web",
"hrefalias": ["/source", "/oss"],
"desc": "Kod źródłowy naszej strony internetowej."
}
]
}

32
data/links.json Normal file
View File

@@ -0,0 +1,32 @@
[
{
"name": "Discord",
"href": "https://discord.gg/NBXq95C",
"hrefalias": ["/discord", "/dsc", "/dc"],
"desc": "Nasz serwer na Discordzie!"
},
{
"name": "YouTube",
"href": "https://www.youtube.com/@gractwopl",
"hrefalias": ["/youtube", "/yt"],
"desc": "Nasz kanał na YouTubie!"
},
{
"name": "Twitter",
"href": "https://twitter.com/gractwo",
"hrefalias": ["/twitter", "/twt"],
"desc": "Nasz profil na Twitterze!"
},
{
"name": "GitHub",
"href": "https://github.com/gractwo",
"hrefalias": ["/github", "/gh"],
"desc": "Nasz org na GitHubie!"
},
{
"name": "Kod Źródłowy",
"href": "https://github.com/gractwo/gractwo-web",
"hrefalias": ["/source", "/oss"],
"desc": "Kod źródłowy naszej strony internetowej."
}
]

18
data/navigation.json Normal file
View File

@@ -0,0 +1,18 @@
[
{
"name": "główna",
"href": "/"
},
{
"name": "o gractwie",
"href": "/o-gractwie"
},
{
"name": "cytaty",
"href": "/cytaty"
},
{
"name": "rankingi",
"href": "/rankingi"
}
]

42
data/splashes.json Normal file
View File

@@ -0,0 +1,42 @@
[
{
"body": "ona jest narysowana debilu",
"author": "jamesen"
},
{
"body": "idą jak surykatki na śmierć puszczone",
"author": "mollin"
},
{
"body": "jak spotkam stacha będziemy się napierdalać",
"author": "KuOlek"
},
{
"body": "to nie kwestia fetyszu, to kwestia prawa izraela",
"author": "stachowiak"
},
{
"body": "czemu ten szkielet ma oczy i czilluje",
"author": "stachowiak"
},
{
"body": "decymalizacja człowieka",
"author": "elephant / suoń"
},
{
"body": "pizdeczka... z całym szacunkiem",
"author": "bavil gravlax"
},
{
"body": "mam dwunastometrowego kija w dupie",
"author": "stachowiak"
},
{
"body": "pamięć wody o jabłku",
"author": "maciuś"
},
{
"body": "właśnie piszę biblię",
"author": "elephant / suoń"
}
]

View File

@@ -1,4 +1,4 @@
const { links } = require("./data/config.json"); const links = require("./data/links.json");
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {

View File

@@ -2,14 +2,12 @@ import styles from "../styles/Index.module.scss";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { SEO } from "../components/SEO"; import { SEO } from "../components/SEO";
import config from "../data/config.json"; import splashes from "../data/splashes.json";
const PageIndex = () => { const PageIndex = () => {
const [splash, setSplash] = useState(""); const [splash, setSplash] = useState("");
function randomizeSplash(): void { function randomizeSplash(): void {
setSplash( setSplash(splashes[Math.floor(Math.random() * splashes.length)].body);
config.splashes[Math.floor(Math.random() * config.splashes.length)].body
);
} }
useEffect(() => { useEffect(() => {
randomizeSplash(); randomizeSplash();