73 lines
1.6 KiB
TypeScript
73 lines
1.6 KiB
TypeScript
import Link from "next/link";
|
|
import React from "react";
|
|
|
|
import styles from "./BottomNav.module.css";
|
|
|
|
interface PagesInfo {
|
|
leftPageLink: string;
|
|
leftPageName: string;
|
|
rightPageLink: string;
|
|
rightPageName: string;
|
|
}
|
|
|
|
export function BottomNav(props: PagesInfo) {
|
|
return (
|
|
<div className={styles.container}>
|
|
<div className={styles.subBox + " " + styles.subBoxLeft}>
|
|
<Link href={props.leftPageLink}>
|
|
<a>
|
|
<Arrow />
|
|
</a>
|
|
</Link>
|
|
<Link href={props.leftPageLink}>
|
|
<a className={styles.item}>{props.leftPageName}</a>
|
|
</Link>
|
|
</div>
|
|
<div className={styles.subBox}>
|
|
<Link href={props.rightPageLink}>
|
|
<a className={styles.item}>{props.rightPageName}</a>
|
|
</Link>
|
|
<Link href={props.rightPageLink}>
|
|
<a>
|
|
<Arrow isPointingRight />
|
|
</a>
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
interface ArrowProps {
|
|
isPointingRight?: boolean;
|
|
}
|
|
|
|
function Arrow({ isPointingRight }: ArrowProps) {
|
|
return (
|
|
<svg className={(isPointingRight ? styles.right : "") + " " + styles.arrow}>
|
|
<defs>
|
|
<marker
|
|
id="arrow"
|
|
markerWidth="10"
|
|
markerHeight="10"
|
|
refX="5"
|
|
refY="3"
|
|
orient="auto"
|
|
markerUnits="strokeWidth"
|
|
>
|
|
<path d="M0,0 L0,6 L9,3 z" className={styles.arrowPath} />
|
|
</marker>
|
|
</defs>
|
|
|
|
<line
|
|
x1="250"
|
|
y1="10"
|
|
x2="100"
|
|
y2="10" // half of svg height
|
|
strokeWidth="3"
|
|
markerEnd="url(#arrow)"
|
|
className={styles.linePath}
|
|
/>
|
|
</svg>
|
|
);
|
|
}
|