mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-20 08:31:39 -07:00
Implement downloads page and May 25th timed copy changes (#1653)
* Add initial side nav * Add Download page as a sub-page under Meth&Data - udpate S3 file path in .envs - remove the DownloadPacket component - move download copy from methodology to download - modify header to use two types of navs: -- mobile (with sub-pages) and -- desktop (without subpages) - create a SubPageNav component - add SubPagNav to Meth and Download page - update snapshots - add global CSS overide to remove minus sign on mobile nav link accordion as it's permanently open * Remove the update tag above Public eng button * Make the 3rd bullet on explore page update on 5/25 * Make the RFI box text change after 5/25/22 * Update site with RFI expired copy, remove Alerts - add Spanish translations - update snapshots * Fix typo on XLS file path * Refactor HowYouCanHelp to standard form * Add custom download links with icons - add new DownloadLink compnent - add Spanish translations * Update download file sizes * Allow meth&data nav link to collapse on mobile
This commit is contained in:
parent
ef46af00f8
commit
226017654a
46 changed files with 966 additions and 1720 deletions
|
@ -0,0 +1,7 @@
|
|||
@use '../../styles/design-system.scss' as *;
|
||||
|
||||
.downloadIcon {
|
||||
height: 1rem;
|
||||
vertical-align: middle;
|
||||
filter: invert(57%) sepia(6%) saturate(3932%) hue-rotate(163deg) brightness(86%) contrast(88%);
|
||||
}
|
13
client/src/components/DownloadLink/DownloadLink.module.scss.d.ts
vendored
Normal file
13
client/src/components/DownloadLink/DownloadLink.module.scss.d.ts
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
declare namespace DownloadLinkNamespace {
|
||||
export interface IDownloadLink {
|
||||
downloadIcon: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare const DownloadLinkModule: DownloadLinkNamespace.IDownloadLink & {
|
||||
/** WARNING: Only available when `css-loader` is used without `style-loader` or `mini-css-extract-plugin` */
|
||||
locals: DownloadLinkNamespace.IDownloadLink;
|
||||
};
|
||||
|
||||
export = DownloadLinkModule;
|
||||
|
16
client/src/components/DownloadLink/DownloadLink.test.tsx
Normal file
16
client/src/components/DownloadLink/DownloadLink.test.tsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
import * as React from 'react';
|
||||
import {render} from '@testing-library/react';
|
||||
import {LocalizedComponent} from '../../test/testHelpers';
|
||||
import DownloadLink from './DownloadLink';
|
||||
|
||||
describe('rendering of the DownloadLink disadvantaged', () => {
|
||||
const {asFragment} = render(
|
||||
<LocalizedComponent>
|
||||
<DownloadLink href="https://google.com" linkText="Google"/>
|
||||
</LocalizedComponent>,
|
||||
);
|
||||
|
||||
it('checks if component renders', () => {
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
});
|
||||
});
|
40
client/src/components/DownloadLink/DownloadLink.tsx
Normal file
40
client/src/components/DownloadLink/DownloadLink.tsx
Normal file
|
@ -0,0 +1,40 @@
|
|||
import React from 'react';
|
||||
import {defineMessages, useIntl} from 'gatsby-plugin-intl';
|
||||
|
||||
import {IDefineMessage} from '../../data/copy/common';
|
||||
|
||||
// @ts-ignore
|
||||
import fileDownloadIcon from '/node_modules/uswds/dist/img/usa-icons/file_download.svg';
|
||||
import * as styles from './DownloadLink.module.scss';
|
||||
|
||||
export const DOWNLOAD_ICON = defineMessages({
|
||||
ALT_TAG: {
|
||||
id: 'downloads.page.download.icon.alt.tag',
|
||||
defaultMessage: 'The icon used to indicate that the file is downloadable',
|
||||
description: 'Navigate to the Downloads page, this is the icon used to indicate that the file is downloadable',
|
||||
},
|
||||
});
|
||||
|
||||
interface IDownloadLink {
|
||||
href: string | IDefineMessage,
|
||||
linkText: string | JSX.Element,
|
||||
}
|
||||
const DownloadLink = ({href, linkText}:IDownloadLink) => {
|
||||
const intl = useIntl();
|
||||
|
||||
if (href && typeof href !== `string`) {
|
||||
href = intl.formatMessage(href);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<a href={href} download>{linkText}</a>
|
||||
<img
|
||||
className={styles.downloadIcon}
|
||||
src={fileDownloadIcon}
|
||||
alt={intl.formatMessage(DOWNLOAD_ICON.ALT_TAG)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default DownloadLink;
|
|
@ -0,0 +1,16 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`rendering of the DownloadLink disadvantaged checks if component renders 1`] = `
|
||||
<DocumentFragment>
|
||||
<a
|
||||
download=""
|
||||
href="https://google.com"
|
||||
>
|
||||
Google
|
||||
</a>
|
||||
<img
|
||||
alt="The icon used to indicate that the file is downloadable"
|
||||
src="test-file-stub"
|
||||
/>
|
||||
</DocumentFragment>
|
||||
`;
|
3
client/src/components/DownloadLink/index.tsx
Normal file
3
client/src/components/DownloadLink/index.tsx
Normal file
|
@ -0,0 +1,3 @@
|
|||
import DownloadLink from './DownloadLink';
|
||||
|
||||
export default DownloadLink;
|
Loading…
Add table
Add a link
Reference in a new issue