Skip to content

Commit b585bb0

Browse files
committed
ADD: footer + minor page re-org
1 parent a3f6e9c commit b585bb0

File tree

6 files changed

+39
-18
lines changed

6 files changed

+39
-18
lines changed

src/app/advanced/[engine]/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React from 'react';
1+
import { redirect } from 'next/navigation'
22

3-
export default function Page({ params }: { params: { engine: string } }) {
4-
return <h1>Hello, : { params.engine }</h1>
3+
export default async function Page({ params }: { params: { engine: string } }) {
4+
redirect(`/advanced/${params.engine}/index.html`);
55
}

src/app/advanced/[engine]/status.html/page.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/app/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { Viewport } from 'next'
44

55
import 'bootstrap/dist/css/bootstrap.css'
66
import './global.css'
7+
import { Footer } from "@/components/Footer";
78

89
export const metadata: Metadata = {
910
title: "RegexPlanet",
@@ -27,6 +28,7 @@ export default function RootLayout({
2728
<div className="container-lg mt-4">
2829
{children}
2930
</div>
31+
<Footer />
3032
</body>
3133
</html>
3234
);
File renamed without changes.

src/components/Footer.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import Link from 'next/link';
2+
3+
const links = [
4+
{ link: 'https://github.com/regexplanet/regexplanet-next', label: 'Source' },
5+
{ link: 'https://github.com/regexplanet/regexplanet-next?tab=readme-ov-file#credits', label: 'Credits' },
6+
//LATER: privacy, terms, etc
7+
];
8+
9+
export function Footer() {
10+
11+
const initial: JSX.Element[] = []
12+
links.forEach((link, index) => {
13+
initial.push(<Link className="text-body-tertiary text-decoration-none" href={link.link} key={link.label}>
14+
{link.label}
15+
</Link>);
16+
if (index < links.length - 1) {
17+
initial.push(<span className="mx-1" key="key{{index}}">|</span>);
18+
}
19+
}
20+
);
21+
22+
return (
23+
<div className="container-lg py-3">
24+
<hr />
25+
<footer className="d-flex justify-content-center text-body-tertiary"><small>
26+
{initial}
27+
</small></footer>
28+
</div>
29+
)
30+
}

src/components/Navbar.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { usePathname } from 'next/navigation'
55
import Link from 'next/link';
66

77
const links = [
8-
{ link: '/testing/index.html', label: 'Testing' },
9-
{ link: '/advanced/status.html', label: 'Status' },
10-
{ link: '/support/index.html', label: 'Support' },
8+
{ link: '/', label: 'Testing', startsWith: '/advanced/' },
9+
{ link: '/status.html', label: 'Status', startsWith: '/status.html'},
10+
{ link: '/support/index.html', label: 'Support', startsWith: '/support/' },
1111
];
1212

1313
export function Navbar() {
@@ -16,7 +16,7 @@ export function Navbar() {
1616
const items = links.map((link) => (
1717
<li className="nav-item" key={link.label} >
1818
<Link
19-
className={pathname.startsWith(link.link) ? 'nav-link active fw-bold' : 'nav-link'}
19+
className={pathname.startsWith(link.startsWith) ? 'nav-link active fw-bold' : 'nav-link'}
2020
href={link.link}
2121
>
2222
{link.label}

0 commit comments

Comments
 (0)