Skip to content

Commit 885625c

Browse files
update page title component (#170)
1 parent d53a790 commit 885625c

10 files changed

+35
-36
lines changed

frontend/app/.server/locales/protected-en.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
"dashboard": {
77
"sin": "SIN",
8-
"sin-system": "<span>SIN</span> Dashboard System",
8+
"sin-system": "SIN Dashboard System",
99
"system": "System",
1010
"assigned-cases": "Affaires Attribuées",
1111
"get-started": "Get Started"
@@ -34,7 +34,6 @@
3434
},
3535
"privacy-statement": {
3636
"confirm-privacy-notice-checkbox": "I agree to the terms and conditions",
37-
"page-title": "Privacy Statement",
38-
"title": "<span>Priv</span>acy Statement"
37+
"page-title": "Privacy Statement"
3938
}
4039
}

frontend/app/.server/locales/protected-fr.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
"dashboard": {
77
"sin": "SIN",
8-
"sin-system": "<span>SIN</span> Interface Système",
8+
"sin-system": "SIN Interface Système",
99
"system": "Système",
1010
"assigned-cases": "Affaires Attribuées",
1111
"get-started": "Commencer Ici"
@@ -34,7 +34,6 @@
3434
},
3535
"privacy-statement": {
3636
"confirm-privacy-notice-checkbox": "J'accepte les termes et conditions.",
37-
"page-title": "Déclaration de confidentialité",
38-
"title": "<span>Décl</span>aration de confidentialité"
37+
"page-title": "Déclaration de confidentialité"
3938
}
4039
}

frontend/app/components/page-title.tsx

+20-10
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,27 @@ import type { ComponentProps } from 'react';
22

33
import { cn } from '~/utils/tailwind-utils';
44

5-
export type PageTitleProps = Omit<ComponentProps<'h1'>, 'id' | 'property'>;
5+
export type PageTitleProps = Omit<ComponentProps<'h1'>, 'id' | 'property'> & {
6+
subTitle?: string;
7+
};
68

7-
export function PageTitle({ children, className, ...props }: PageTitleProps) {
9+
export function PageTitle({ children, className, subTitle, ...props }: PageTitleProps) {
810
return (
9-
<h1
10-
id="wb-cont"
11-
tabIndex={-1}
12-
className={cn('font-lato mt-10 text-3xl font-bold focus-visible:ring-3', className)}
13-
{...props}
14-
>
15-
{children}
16-
</h1>
11+
<div className="mt-10 mb-8">
12+
{subTitle && <h2>{subTitle}</h2>}
13+
<h1
14+
id="wb-cont"
15+
tabIndex={-1}
16+
className={cn(
17+
'font-lato text-3xl font-bold focus-visible:ring-3',
18+
'after:mt-2 after:block after:h-1.5 after:w-18 after:bg-red-700',
19+
20+
className,
21+
)}
22+
{...props}
23+
>
24+
{children}
25+
</h1>
26+
</div>
1727
);
1828
}

frontend/app/routes/protected/index.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type { Route } from './+types/index';
88

99
import { requireAuth } from '~/.server/utils/auth-utils';
1010
import { ButtonLink } from '~/components/button-link';
11+
import { PageTitle } from '~/components/page-title';
1112
import { getFixedT } from '~/i18n-config.server';
1213
import { handle as parentHandle } from '~/routes/protected/layout';
1314

@@ -30,12 +31,7 @@ export default function Index() {
3031

3132
return (
3233
<div className="mb-8">
33-
<h1 className="mt-8 text-2xl font-bold text-slate-700">
34-
<Trans
35-
i18nKey="protected:dashboard.sin-system"
36-
components={{ span: <span className="underline decoration-red-800 underline-offset-8" /> }}
37-
/>
38-
</h1>
34+
<PageTitle>{t('protected:dashboard.sin-system')}</PageTitle>
3935
<h2 className="mt-10 mb-2 text-lg font-bold text-slate-700">{t('protected:dashboard.assigned-cases')}</h2>
4036
<ButtonLink className="w-72" file="routes/protected/request.tsx">
4137
{t('gcweb:app.form')}

frontend/app/routes/protected/person-case/privacy-statement.tsx

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { data, useFetcher } from 'react-router';
22
import type { RouteHandle } from 'react-router';
33

4-
import { Trans, useTranslation } from 'react-i18next';
4+
import { useTranslation } from 'react-i18next';
55
import * as v from 'valibot';
66

77
import type { Route, Info } from './+types/privacy-statement';
@@ -13,6 +13,7 @@ import { Button } from '~/components/button';
1313
import { ButtonLink } from '~/components/button-link';
1414
import { ErrorSummary } from '~/components/error-summary';
1515
import { InputCheckbox } from '~/components/input-checkbox';
16+
import { PageTitle } from '~/components/page-title';
1617
import { Progress } from '~/components/progress';
1718
import { getFixedT } from '~/i18n-config.server';
1819
import { handle as parentHandle } from '~/routes/protected/layout';
@@ -69,14 +70,8 @@ export default function PrivacyStatement({ loaderData, actionData, params }: Rou
6970

7071
return (
7172
<>
72-
<Progress className="mt-8 mb-8" label="" value={20} />
73-
<span className="text-md">{t('protected:in-person.title')}</span>
74-
<h1 className="mb-8 text-2xl font-bold text-slate-700">
75-
<Trans
76-
i18nKey="protected:privacy-statement.title"
77-
components={{ span: <span className="underline decoration-red-800 underline-offset-8" /> }}
78-
/>
79-
</h1>
73+
<Progress className="mt-8" label="" value={20} />
74+
<PageTitle subTitle={t('protected:in-person.title')}>{t('protected:privacy-statement.page-title')}</PageTitle>
8075

8176
<fetcher.Form method="post" noValidate>
8277
<div className="space-y-6">
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 my-8"><span>We couldn't find that web page</span><small class="block text-2xl font-normal text-neutral-500">(Error 404)</small></h1><p class="mb-8 text-lg text-gray-500">We're sorry you ended up here. Sometimes a page gets moved or deleted, but hopefully we can help you find what you're looking for.</p>
1+
<div class="mt-10 mb-8"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 after:mt-2 after:block after:h-1.5 after:w-18 after:bg-red-700 my-8"><span>We couldn't find that web page</span><small class="block text-2xl font-normal text-neutral-500">(Error 404)</small></h1></div><p class="mb-8 text-lg text-gray-500">We're sorry you ended up here. Sometimes a page gets moved or deleted, but hopefully we can help you find what you're looking for.</p>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<div class="grid grid-cols-1 gap-6 py-2.5 sm:grid-cols-2 sm:py-3.5"><div id="english" lang="en"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 my-8"><span>We couldn't find that web page</span><small class="block text-2xl font-normal text-neutral-500">(Error 404)</small></h1><p class="mb-8 text-lg text-gray-500">We're sorry you ended up here. Sometimes a page gets moved or deleted, but hopefully we can help you find what you're looking for.</p></div><div id="french" lang="fr"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 my-8"><span>Nous ne pouvons trouver cette page</span><small class="block text-2xl font-normal text-neutral-500">(Erreur 404)</small></h1><p class="mb-8 text-lg text-gray-500">Nous sommes désolés que vous ayez abouti ici. Il arrive parfois qu'une page ait été déplacée ou supprimée. Heureusement, nous pouvons vous aider à trouver ce que vous cherchez.</p></div></div>
1+
<div class="grid grid-cols-1 gap-6 py-2.5 sm:grid-cols-2 sm:py-3.5"><div id="english" lang="en"><div class="mt-10 mb-8"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 after:mt-2 after:block after:h-1.5 after:w-18 after:bg-red-700 my-8"><span>We couldn't find that web page</span><small class="block text-2xl font-normal text-neutral-500">(Error 404)</small></h1></div><p class="mb-8 text-lg text-gray-500">We're sorry you ended up here. Sometimes a page gets moved or deleted, but hopefully we can help you find what you're looking for.</p></div><div id="french" lang="fr"><div class="mt-10 mb-8"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 after:mt-2 after:block after:h-1.5 after:w-18 after:bg-red-700 my-8"><span>Nous ne pouvons trouver cette page</span><small class="block text-2xl font-normal text-neutral-500">(Erreur 404)</small></h1></div><p class="mb-8 text-lg text-gray-500">Nous sommes désolés que vous ayez abouti ici. Il arrive parfois qu'une page ait été déplacée ou supprimée. Heureusement, nous pouvons vous aider à trouver ce que vous cherchez.</p></div></div>
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`BilingualErrorBoundary > should render the bilingual error boundary > expected html 1`] = `"<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="modulepreload" href="build/stub-path-to-module.js"></head><body><header class="border-b-[3px] border-slate-700 print:hidden"><div id="wb-bnr"><div class="container flex items-center justify-between gap-6 py-2.5 sm:py-3.5"><a href="https://canada.ca/"><img class="h-8 w-auto" alt="gcweb:header.govt-of-canada.text / gcweb:header.govt-of-canada.text" width="300" height="28" decoding="async" src="https://www.canada.ca/etc/designs/canada/wet-boew/assets/sig-blk-en.svg"></a></div></div></header><main class="container"><div class="grid grid-cols-1 gap-6 py-2.5 sm:grid-cols-2 sm:py-3.5"><div id="english" lang="en"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 my-8"><span>gcweb:server-error.page-title</span><small class="block text-2xl font-normal text-neutral-500">{"key":"gcweb:server-error.page-subtitle","options":{"statusCode":500}}</small></h1><p class="mb-8 text-lg text-gray-500">gcweb:server-error.page-message</p></div><div id="french" lang="fr"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 my-8"><span>gcweb:server-error.page-title</span><small class="block text-2xl font-normal text-neutral-500">{"key":"gcweb:server-error.page-subtitle","options":{"statusCode":500}}</small></h1><p class="mb-8 text-lg text-gray-500">gcweb:server-error.page-message</p></div></div></main><footer id="wb-info" tabindex="-1" class="mt-8 bg-stone-50 print:hidden"><div class="container flex items-center justify-end gap-6 py-2.5 sm:py-3.5"><div><h2 class="sr-only"><span lang="en">gcweb:footer.about-site</span> / <span lang="fr">gcweb:footer.about-site</span></h2><div><img alt="gcweb:footer.gc-symbol / gcweb:footer.gc-symbol" width="300" height="71" class="h-10 w-auto" src="https://www.canada.ca/etc/designs/canada/wet-boew/assets/wmms-blk.svg"></div></div></div></footer><link rel="modulepreload"><script> </script><script type="module" async=""> </script><script src="/api/client-env?v=undefined"></script></body></html>"`;
3+
exports[`BilingualErrorBoundary > should render the bilingual error boundary > expected html 1`] = `"<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="modulepreload" href="build/stub-path-to-module.js"></head><body><header class="border-b-[3px] border-slate-700 print:hidden"><div id="wb-bnr"><div class="container flex items-center justify-between gap-6 py-2.5 sm:py-3.5"><a href="https://canada.ca/"><img class="h-8 w-auto" alt="gcweb:header.govt-of-canada.text / gcweb:header.govt-of-canada.text" width="300" height="28" decoding="async" src="https://www.canada.ca/etc/designs/canada/wet-boew/assets/sig-blk-en.svg"></a></div></div></header><main class="container"><div class="grid grid-cols-1 gap-6 py-2.5 sm:grid-cols-2 sm:py-3.5"><div id="english" lang="en"><div class="mt-10 mb-8"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 after:mt-2 after:block after:h-1.5 after:w-18 after:bg-red-700 my-8"><span>gcweb:server-error.page-title</span><small class="block text-2xl font-normal text-neutral-500">{"key":"gcweb:server-error.page-subtitle","options":{"statusCode":500}}</small></h1></div><p class="mb-8 text-lg text-gray-500">gcweb:server-error.page-message</p></div><div id="french" lang="fr"><div class="mt-10 mb-8"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 after:mt-2 after:block after:h-1.5 after:w-18 after:bg-red-700 my-8"><span>gcweb:server-error.page-title</span><small class="block text-2xl font-normal text-neutral-500">{"key":"gcweb:server-error.page-subtitle","options":{"statusCode":500}}</small></h1></div><p class="mb-8 text-lg text-gray-500">gcweb:server-error.page-message</p></div></div></main><footer id="wb-info" tabindex="-1" class="mt-8 bg-stone-50 print:hidden"><div class="container flex items-center justify-end gap-6 py-2.5 sm:py-3.5"><div><h2 class="sr-only"><span lang="en">gcweb:footer.about-site</span> / <span lang="fr">gcweb:footer.about-site</span></h2><div><img alt="gcweb:footer.gc-symbol / gcweb:footer.gc-symbol" width="300" height="71" class="h-10 w-auto" src="https://www.canada.ca/etc/designs/canada/wet-boew/assets/wmms-blk.svg"></div></div></div></footer><link rel="modulepreload"><script> </script><script type="module" async=""> </script><script src="/api/client-env?v=undefined"></script></body></html>"`;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`PageTitle > should render a h1 tag with default styles > expected html 1`] = `"<h1 id="wb-cont" tabindex="-1" class="font-lato mt-10 text-3xl font-bold focus-visible:ring-3">Test Title</h1>"`;
3+
exports[`PageTitle > should render a h1 tag with default styles > expected html 1`] = `"<div class="mt-10 mb-8"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 after:mt-2 after:block after:h-1.5 after:w-18 after:bg-red-700">Test Title</h1></div>"`;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3-
exports[`UnilingualErrorBoundary > should render the unilingual error boundary > expected html 1`] = `"<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="modulepreload" href="build/stub-path-to-module.js"></head><body><header class="border-b-[3px] border-slate-700 print:hidden"><div id="wb-bnr"><div class="container flex items-center justify-between gap-6 py-2.5 sm:py-3.5"><a href="https://canada.ca/"><img class="h-8 w-auto" alt="gcweb:header.govt-of-canada.text" width="300" height="28" decoding="async" src="https://www.canada.ca/etc/designs/canada/wet-boew/assets/sig-blk-en.svg"></a></div></div></header><main class="container"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 my-8"><span>gcweb:server-error.page-title</span><small class="block text-2xl font-normal text-neutral-500">{"key":"gcweb:server-error.page-subtitle","options":{"statusCode":500}}</small></h1><p class="mb-8 text-lg text-gray-500">gcweb:server-error.page-message</p></main><footer id="wb-info" tabindex="-1" class="mt-8 bg-stone-50 print:hidden"><div class="container flex items-center justify-end gap-6 py-2.5 sm:py-3.5"><div><h2 class="sr-only">gcweb:footer.about-site</h2><div><img alt="gcweb:footer.gc-symbol" width="300" height="71" class="h-10 w-auto" src="https://www.canada.ca/etc/designs/canada/wet-boew/assets/wmms-blk.svg"></div></div></div></footer><link rel="modulepreload"><script> </script><script type="module" async=""> </script><script src="/api/client-env?v=undefined"></script></body></html>"`;
3+
exports[`UnilingualErrorBoundary > should render the unilingual error boundary > expected html 1`] = `"<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="modulepreload" href="build/stub-path-to-module.js"></head><body><header class="border-b-[3px] border-slate-700 print:hidden"><div id="wb-bnr"><div class="container flex items-center justify-between gap-6 py-2.5 sm:py-3.5"><a href="https://canada.ca/"><img class="h-8 w-auto" alt="gcweb:header.govt-of-canada.text" width="300" height="28" decoding="async" src="https://www.canada.ca/etc/designs/canada/wet-boew/assets/sig-blk-en.svg"></a></div></div></header><main class="container"><div class="mt-10 mb-8"><h1 id="wb-cont" tabindex="-1" class="font-lato text-3xl font-bold focus-visible:ring-3 after:mt-2 after:block after:h-1.5 after:w-18 after:bg-red-700 my-8"><span>gcweb:server-error.page-title</span><small class="block text-2xl font-normal text-neutral-500">{"key":"gcweb:server-error.page-subtitle","options":{"statusCode":500}}</small></h1></div><p class="mb-8 text-lg text-gray-500">gcweb:server-error.page-message</p></main><footer id="wb-info" tabindex="-1" class="mt-8 bg-stone-50 print:hidden"><div class="container flex items-center justify-end gap-6 py-2.5 sm:py-3.5"><div><h2 class="sr-only">gcweb:footer.about-site</h2><div><img alt="gcweb:footer.gc-symbol" width="300" height="71" class="h-10 w-auto" src="https://www.canada.ca/etc/designs/canada/wet-boew/assets/wmms-blk.svg"></div></div></div></footer><link rel="modulepreload"><script> </script><script type="module" async=""> </script><script src="/api/client-env?v=undefined"></script></body></html>"`;

0 commit comments

Comments
 (0)