Content Migration from websites repo

This commit is contained in:
Neshura 2022-12-03 21:02:24 +01:00
parent f6eb9794a9
commit f58a45df06
No known key found for this signature in database
GPG key ID: ACDF5B6EBECF6B0A
24 changed files with 7575 additions and 1 deletions

11
components/footer.tsx Normal file
View file

@ -0,0 +1,11 @@
import styles from '/styles/Home.module.css'
const Footer = () => {
return (
<footer className={styles.footer}>
Built using Next.js
</footer>
);
}
export default Footer;

31
components/layout.tsx Normal file
View file

@ -0,0 +1,31 @@
import Footer from './footer'
import Navbar from './navbar'
import styles from '/styles/Home.module.css'
import UseSWR from 'swr'
const fetcher = (url:string) => fetch(url).then((res) => res.json())
function Layout({ children }: {children: React.ReactNode} ):JSX.Element {
const { data, error } = UseSWR('/api/navbar', fetcher)
let layout: JSX.Element = <></>
if (error) layout = <><div>Failed to load data</div></>
if (!data) {
layout = <></>
}
if(data) {
layout =
<>
<Navbar links={data.links} />
<main className={styles.main}>
{children}
</main>
<Footer />
</>
}
return layout
}
export default Layout;

25
components/navbar.tsx Normal file
View file

@ -0,0 +1,25 @@
import styles from '../styles/Home.module.css'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { LinkList, CustomLink } from '../interfaces/LinkTypes';
function Navbar(props: LinkList) {
const router = useRouter();
const navLinks = props.links
return (
<div className={styles.header}>
<Link key="home" href="https://www.neshura-server.net">
<a className={styles.home}>Home</a>
</Link>
<nav className={styles.navbar}>
{navLinks.map((item: CustomLink) => (
<Link key={item.name} href={item.href}>
<a className={router.pathname == item.href ? styles.navelem_active : styles.navelem}>{item.name}</a>
</Link>
))}
</nav>
</div>
);
}
export default Navbar;