Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jurisdiction to canonical form URLs #69

Merged
merged 19 commits into from
Sep 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes toUpperCase() build error by using CSS, instead
samglover committed Sep 11, 2024
commit 0ba05fb0030a6b33467c06414474b1fcc40e870a
5 changes: 3 additions & 2 deletions src/app/[path]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { pathToServerConfig } from '../../config/formSources.config';

// This is only necessary because there is a bug within next that doesnt allow static params to be passed from page to page properly. This layout only exists to assist in passing said props

// This is only necessary because there is a bug within next that doesnt allow
// static params to be passed from page to page properly. This layout only exists
// to assist in passing those params.
export async function generateStaticParams() {
return Object.keys(pathToServerConfig).map((key) => ({
path: key.toLowerCase(),
25 changes: 9 additions & 16 deletions src/app/components/NavigationBar.tsx
Original file line number Diff line number Diff line change
@@ -3,26 +3,19 @@ import Image from 'next/image';
import Link from 'next/link';
import { useParams } from 'next/navigation';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faArrowUpRightFromSquare } from '@fortawesome/free-solid-svg-icons';
import { faLanguage } from '@fortawesome/free-solid-svg-icons';
import {
faArrowUpRightFromSquare,
faLanguage,
} from '@fortawesome/free-solid-svg-icons';
import { prefix } from '../../../prefix';
import styles from '../css/NavigationBar.module.css';
import nextConfig from '../../../next.config';

interface PageProps {
params: {
path: string;
};
}

export default function NavigationBar({ params }: PageProps) {
const { path = '' } = useParams();
let abbrev = '';
export default function NavigationBar() {
const params = useParams();
const path = params.path;
let pathSegment = '';
if (typeof path === 'string' && path.trim().length > 0) {
abbrev = ' ' + path.toUpperCase();
pathSegment = '/' + path;
}
if (path && path.length > 0) pathSegment = '/' + path;
return (
<nav
role="navigation"
@@ -84,7 +77,7 @@ export default function NavigationBar({ params }: PageProps) {
</li> */}
<li className="nav-item">
<Link href={pathSegment + '/forms'} className={styles.NavLink}>
All{abbrev} Forms
All <span className={styles.AllFormsPath}>{path}</span> Forms
</Link>
</li>
<li className="nav-item">
5 changes: 5 additions & 0 deletions src/app/css/NavigationBar.module.css
Original file line number Diff line number Diff line change
@@ -20,6 +20,11 @@
&:not(:hover) {
text-decoration: none;
}

}

.AllFormsPath {
text-transform: uppercase;
}

.ExternalLinkIcon {
21 changes: 13 additions & 8 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import './globals.css';
import { Inter } from 'next/font/google';
import 'bootstrap/dist/css/bootstrap.css';
import Script from 'next/script';

import NavigationBar from './components/NavigationBar';
import Footer from './components/Footer';

import 'bootstrap/dist/css/bootstrap.css';
import '@fortawesome/fontawesome-free/css/all.min.css';
import '@fontsource/inter/700.css'; // Bold weight
import Script from 'next/script';
import './globals.css';

const inter = Inter({ subsets: ['latin'] });

@@ -15,19 +17,22 @@ export const metadata = {
'Free online interactive court forms from Suffolk University Law School',
};

interface LayoutParams {
params: {
path: string;
};
}

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
// console.log('params: ' + JSON.stringify(params));
return (
<html lang="en">
<body className={inter.className}>
<NavigationBar
params={{
path: '',
}}
/>
<NavigationBar />
<div className="body-container">{children}</div>
<Footer />
</body>