Init next.js port

This commit is contained in:
2021-12-07 22:38:31 -05:00
parent ba6071d2a6
commit 9f56e40d1c
38 changed files with 18522 additions and 2 deletions

52
components/title.tsx Normal file
View File

@@ -0,0 +1,52 @@
import style from '../styles/title.module.css';
import Link from 'next/link';
import { useEffect, useState } from 'react';
type propsObj = {
name: string,
title?: string,
ancestors?: Array<{ name: string, path: string }>
};
function Title(props: propsObj) {
const path = () => {
if (!props.ancestors)
return (<></>);
let currentPath = '';
return (<>
{
props.ancestors.map(ancestor => {
currentPath += `/${ancestor.path}`
return (
<>
<Link href={currentPath} key=''>
<a>{ancestor.name}</a>
</Link>
<> / </>
</>
);
})
}
</>
);
};
return (
<>
<h1 className={style.container}>
{props.title || props.name}
</h1>
<div className={style.nav + ' h1'}>
{
props.name === ''
? <>PaulW.XYZ / {props.name}</>
: <><Link href='/'><a>PaulW.XYZ</a></Link> / {path()}{props.name}</>
}
</div>
</>
);
}
export default Title;