Skip to content

Commit

Permalink
feat: add page contents navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
pataruco committed Jan 14, 2025
1 parent 690c69b commit be2a509
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 11 deletions.
13 changes: 9 additions & 4 deletions website/src/app/[lang]/register-a-patient/page-body.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import PageContents from '@components/page-contents';
import styles from './page-body.module.scss';

import PageContents from '@components/page-contents';
import PageLatestNews from '@components/page-latest-news';
import SignupForm from '@components/signup-form';
import type { AvailableLocale } from '@i18n/locales';
import { createHashLink } from '@shared/utils/hash-links';

interface RegisterPageBodyProps {
lang: AvailableLocale;
Expand Down Expand Up @@ -36,7 +37,7 @@ const RegisterPageBody: React.FC<RegisterPageBodyProps> = ({ lang }) => {
</li>
</ul>
<section>
<h2>Register with us</h2>
<h2 id={createHashLink('Register with us')}>Register with us</h2>
<p>
We want to keep track of the number of diagnosed cases around the
world, so that we can share this with you and our community of
Expand All @@ -47,7 +48,9 @@ const RegisterPageBody: React.FC<RegisterPageBodyProps> = ({ lang }) => {
<SignupForm lang={lang} registerPatient />
</section>
<section>
<h2>Register with the NR2F1 Patient Registry</h2>
<h2 id={createHashLink('Register with the NR2F1 Patient Registry')}>
Register with the NR2F1 Patient Registry
</h2>
<p>
The Patient Registry collects information through surveys on how a
disease affects a person over a lifetime to better understand
Expand Down Expand Up @@ -172,7 +175,9 @@ const RegisterPageBody: React.FC<RegisterPageBodyProps> = ({ lang }) => {
</section>

<section>
<h2>Register for a Clinical Research ID</h2>
<h2 id={createHashLink('Register for a Clinical Research ID')}>
Register for a Clinical Research ID
</h2>
<p>
The Clinical Research ID (CRID) is a free patient-generated
service specifically for use in clinical research. The parent or
Expand Down
33 changes: 27 additions & 6 deletions website/src/components/page-contents/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createHashLink } from '@shared/utils/hash-links';
import styles from './index.module.scss';

import type { AvailableLocale, LocalisedString } from '@i18n/locales';
Expand All @@ -23,13 +24,23 @@ const PageContents: React.FC<PageContentsProps> = ({ lang }) => {
<nav>
<ul>
<li>
<a href="/">Register with us</a>
<a href={`#${createHashLink('Register with us')}`}>
Register with us
</a>
</li>
<li>
<a href="/">Register with the NR2F1 Patient Registry</a>
<a
href={`#${createHashLink('Register with the NR2F1 Patient Registry')}`}
>
Register with the NR2F1 Patient Registry
</a>
</li>
<li>
<a href="/">Register for a Clinical Research ID</a>
<a
href={`#${createHashLink('Register for a Clinical Research ID')}`}
>
Register for a Clinical Research ID
</a>
</li>
</ul>
</nav>
Expand All @@ -39,13 +50,23 @@ const PageContents: React.FC<PageContentsProps> = ({ lang }) => {
<nav>
<ul>
<li>
<a href="/">Register with us</a>
<a href={`#${createHashLink('Register with us')}`}>
Register with us
</a>
</li>
<li>
<a href="/">Register with the NR2F1 Patient Registry</a>
<a
href={`#${createHashLink('Register with the NR2F1 Patient Registry')}`}
>
Register with the NR2F1 Patient Registry
</a>
</li>
<li>
<a href="/">Register for a Clinical Research ID</a>
<a
href={`#${createHashLink('Register for a Clinical Research ID')}`}
>
Register for a Clinical Research ID
</a>
</li>
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion website/src/shared/utils/hash-links.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const createHashLink = (text: string): string => {
export const createHashLink = (text: string): string => {
return text
.toLowerCase()
.replace(/ /g, '-')
Expand Down
1 change: 1 addition & 0 deletions website/src/styles/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

html {
font-size: 100%;
scroll-behavior: smooth;
}

body {
Expand Down

0 comments on commit be2a509

Please sign in to comment.