mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-15 04:41:39 -07:00
Update version number on frontend (#730)
* Update version number on frontend - add verion to download packet - add verison to side panel - update snaphots - add version to constant file * Add minor UI changes from QA - adjust copy in download package - update tests * Refactor all intl code and will add page tests - remove all copy app wide and place into respective data/copy folder - adds tests for each page - allow product to make copy changes in one place - prepare for spanish language effort
This commit is contained in:
parent
b1a4d26be8
commit
53c2d98eaa
41 changed files with 3992 additions and 1050 deletions
|
@ -1,7 +1,8 @@
|
|||
import React from 'react';
|
||||
import {useIntl} from 'gatsby-plugin-intl';
|
||||
import {defineMessages} from 'react-intl';
|
||||
|
||||
import * as styles from './datasetCard.module.scss';
|
||||
import * as METHODOLOGY_COPY from '../../data/copy/methodology';
|
||||
|
||||
interface IDatasetCardProps {
|
||||
datasetCardProps: { [key:string]: string }
|
||||
|
@ -10,23 +11,6 @@ interface IDatasetCardProps {
|
|||
|
||||
const DatasetCard = ({datasetCardProps, additionalIndicator}:IDatasetCardProps) => {
|
||||
const intl = useIntl();
|
||||
const messages = defineMessages({
|
||||
dataResolution: {
|
||||
id: 'datasetCard.dataResolution',
|
||||
defaultMessage: 'Data resolution: ',
|
||||
description: 'label associated with explaining the card',
|
||||
},
|
||||
dataSource: {
|
||||
id: 'datasetCard.dataSource',
|
||||
defaultMessage: 'Data source: ',
|
||||
description: 'label associated with explaining the card',
|
||||
},
|
||||
dataDateRange: {
|
||||
id: 'datasetCard.dataDateRange',
|
||||
defaultMessage: 'Data date range: ',
|
||||
description: 'label associated with explaining the card',
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<div className={additionalIndicator ? styles.datasetCardAdditional : styles.datasetCard}>
|
||||
|
@ -38,7 +22,7 @@ const DatasetCard = ({datasetCardProps, additionalIndicator}:IDatasetCardProps)
|
|||
<ul className={styles.datasetCardList}>
|
||||
<li className={styles.datasetCardListItem}>
|
||||
<span className={styles.datasetCardLabels}>
|
||||
{intl.formatMessage(messages.dataSource)}
|
||||
{intl.formatMessage(METHODOLOGY_COPY.DATASET_CARD_LABELS.SOURCE)}
|
||||
</span>
|
||||
<a href={datasetCardProps.dataSourceURL} target={'_blank'} rel="noreferrer">
|
||||
{datasetCardProps.dataSourceLabel}
|
||||
|
@ -46,13 +30,13 @@ const DatasetCard = ({datasetCardProps, additionalIndicator}:IDatasetCardProps)
|
|||
</li>
|
||||
<li className={styles.datasetCardListItem}>
|
||||
<span className={styles.datasetCardLabels}>
|
||||
{intl.formatMessage(messages.dataResolution)}
|
||||
{intl.formatMessage(METHODOLOGY_COPY.DATASET_CARD_LABELS.RESOLUTION)}
|
||||
</span>
|
||||
{datasetCardProps.dataResolution}
|
||||
</li>
|
||||
<li className={styles.datasetCardListItem}>
|
||||
<span className={styles.datasetCardLabels}>
|
||||
{intl.formatMessage(messages.dataDateRange)}
|
||||
{intl.formatMessage(METHODOLOGY_COPY.DATASET_CARD_LABELS.DATE_RANGE)}
|
||||
</span>
|
||||
{datasetCardProps.dataDateRange}
|
||||
</li>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`rendering of the DatasetCard checks if component renders 1`] = `
|
||||
exports[`rendering of addtional indicator dataset card checks if component renders 1`] = `<DocumentFragment />`;
|
||||
|
||||
exports[`rendering of indicator dataset card checks if component renders 1`] = `
|
||||
<DocumentFragment>
|
||||
<div>
|
||||
<h3>
|
||||
|
|
|
@ -3,12 +3,24 @@ import {render} from '@testing-library/react';
|
|||
import {LocalizedComponent} from '../../../test/testHelpers';
|
||||
import DatasetCard from '../../DatasetCard';
|
||||
|
||||
import {indicators} from '../../DatasetContainer/index';
|
||||
import * as METHODOLOGY_COPY from '../../../data/copy/methodology';
|
||||
|
||||
describe('rendering of the DatasetCard', () => {
|
||||
describe('rendering of indicator dataset card', () => {
|
||||
const {asFragment} = render(
|
||||
<LocalizedComponent>
|
||||
<DatasetCard key={0} datasetCardProps={indicators[0]}/>
|
||||
<DatasetCard key={0} datasetCardProps={METHODOLOGY_COPY.INDICATORS[0]} additionalIndicator={false}/>
|
||||
</LocalizedComponent>,
|
||||
);
|
||||
|
||||
it('checks if component renders', () => {
|
||||
expect(asFragment()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe('rendering of addtional indicator dataset card', () => {
|
||||
const {asFragment} = render(
|
||||
<LocalizedComponent>
|
||||
<DatasetCard key={0} datasetCardProps={METHODOLOGY_COPY.ADDITIONAL_INDICATORS[0]} additionalIndicator={true}/>
|
||||
</LocalizedComponent>,
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue