mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-22 23:31:39 -07:00
Updates intl file with latest copy (#795)
* Extract 404 page copy to intl * Move all copy to data copy folder and add tests - Add test:intl-extraction script - Fix certain defaultMessages not appearing - update snapshot
This commit is contained in:
parent
a94b8e2761
commit
d1511287b8
11 changed files with 199 additions and 140 deletions
|
@ -1,11 +1,11 @@
|
|||
import * as React from 'react';
|
||||
import {defineMessages} from 'react-intl';
|
||||
import {Link} from 'gatsby-plugin-intl';
|
||||
import {useIntl} from 'gatsby-plugin-intl';
|
||||
import {Grid} from '@trussworks/react-uswds';
|
||||
|
||||
import J40MainGridContainer from '../components/J40MainGridContainer';
|
||||
import Layout from '../components/layout';
|
||||
import * as PAGE_NOT_FOUND_COPY from '../data/copy/404';
|
||||
|
||||
const codeStyles = {
|
||||
color: '#8A6534',
|
||||
|
@ -22,62 +22,30 @@ interface I404PageProps {
|
|||
// markup
|
||||
const NotFoundPage =({location}: I404PageProps) => {
|
||||
const intl = useIntl();
|
||||
const messages = defineMessages({
|
||||
pageNotFoundTitle: {
|
||||
id: 'pageNotFound.title.text',
|
||||
defaultMessage: 'Page not found',
|
||||
description: 'page not found title text',
|
||||
},
|
||||
pageNotFoundHeading: {
|
||||
id: 'pageNotFound.heading.text',
|
||||
defaultMessage: 'Page not found',
|
||||
description: 'page not found heading text',
|
||||
},
|
||||
pageNotFoundApology: {
|
||||
id: 'pageNotFound.apology.text',
|
||||
defaultMessage: 'Sorry',
|
||||
description: 'page not found apology text',
|
||||
},
|
||||
pageNotFoundApologyDescription: {
|
||||
id: 'pageNotFound.apology.description.text',
|
||||
defaultMessage: 'we couldn’t find what you were looking for.',
|
||||
description: 'page not found apology description text',
|
||||
},
|
||||
pageNotFoundGuidance: {
|
||||
id: 'pageNotFound.Guidance.text',
|
||||
defaultMessage: 'Try creating a page in',
|
||||
description: 'page not found guidance text',
|
||||
},
|
||||
pageNotFoundLinkToGoHome: {
|
||||
id: 'pageNotFound.link.to.go.home.text',
|
||||
defaultMessage: 'Go home',
|
||||
description: 'page not found link to go home text',
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<Layout location={location} title={intl.formatMessage(messages.pageNotFoundTitle)}>
|
||||
<Layout location={location} title={intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.TITLE)}>
|
||||
<J40MainGridContainer>
|
||||
|
||||
<Grid row>
|
||||
<h1>{intl.formatMessage(messages.pageNotFoundHeading)}</h1>
|
||||
<h1>{intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.HEADING)}</h1>
|
||||
</Grid>
|
||||
|
||||
<Grid row>
|
||||
<p>
|
||||
{intl.formatMessage(messages.pageNotFoundApology)}
|
||||
{intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.APOLOGY)}
|
||||
{' '}
|
||||
<span role="img" aria-label="Pensive emoji">
|
||||
😔
|
||||
</span>{' '}
|
||||
{intl.formatMessage(messages.pageNotFoundApologyDescription)}
|
||||
{intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.APOLOGY_INFO)}
|
||||
</p>
|
||||
</Grid>
|
||||
|
||||
<Grid row>
|
||||
{process.env.NODE_ENV === 'development' ? (
|
||||
<p>
|
||||
{intl.formatMessage(messages.pageNotFoundGuidance)}
|
||||
{intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.GUIDANCE)}
|
||||
<code style={codeStyles}>src/pages/</code>.
|
||||
</p>
|
||||
) : null}
|
||||
|
@ -85,7 +53,7 @@ const NotFoundPage =({location}: I404PageProps) => {
|
|||
|
||||
<Grid>
|
||||
<p>
|
||||
<Link to="/">{intl.formatMessage(messages.pageNotFoundLinkToGoHome)}</Link>.
|
||||
<Link to="/">{intl.formatMessage(PAGE_NOT_FOUND_COPY.PAGE.LINK_HOME)}</Link>.
|
||||
</p>
|
||||
</Grid>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue