Migrate to Next

This commit is contained in:
2022-11-11 22:41:53 +00:00
parent 58e38dbedd
commit 4aaad4d704
352 changed files with 15583 additions and 21335 deletions

26
components/Button.js Normal file
View File

@@ -0,0 +1,26 @@
import React from "react";
import Link from "next/link";
import styles from "./Button.module.css";
export default function Button({ children, type, href }) {
const isInternal = /^\/(?!\/)/.test(href);
if (isInternal) {
return (
<Link href={href} passHref>
<a className={styles.block}>{children}</a>
</Link>
);
}
if (type === "submit") {
return (
<button type="submit" className={styles.block}>
{children}
</button>
);
}
return (
<a className={styles.block} href={href}>
{children}
</a>
);
}