Skip to content

Commit

Permalink
Merge pull request #2866 from uktrade/refactor/react-structure
Browse files Browse the repository at this point in the history
Restructure React files and folders
  • Loading branch information
ian-leggett authored Nov 20, 2023
2 parents 4e5ee8c + 1bffdab commit 6ebb2b8
Show file tree
Hide file tree
Showing 22 changed files with 324 additions and 216 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { default as DataDisplay } from './DataDisplay';
export { default as FetchDataContainer } from './FetchDataContainer';
export { default as Tile } from './Tile';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SupportYou from '../support-you/SupportYou';
import SupportYou from '../support/Support';

const HomePage = () => {
return (
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Meta, StoryObj } from '@storybook/react';

import SupportYou from './Support';

const meta = {
title: 'Support You feature',
component: SupportYou
} satisfies Meta<typeof SupportYou>;

type Story = StoryObj<typeof SupportYou>;

export const WithTiles: Story = {
render: () => <SupportYou />
};

export default meta;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { render } from '@testing-library/react';

import Support from './Support';

describe('Support', () => {
it('renders a H2 header', () => {
const { getByRole } = render(<Support />);
const header = getByRole('heading', {
level: 2,
name: 'How can we support you?'
});
expect(header).toBeInTheDocument();
});
it('renders TilesContainer with GetHelp and OtherSupport components', () => {
const { queryAllByRole } = render(<Support />);
const headers = queryAllByRole('heading', { level: 3 });
expect(headers.length).toBe(2);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { MEDIA_QUERIES, SPACING_POINTS } from '@govuk-react/constants';
import { H2 } from 'govuk-react';
import styled from 'styled-components';

import GetHelp from '../../components/GetHelp';
import OtherSupport from '../../components/OtherSupport';
import { WHITE } from '../../constants';
import GetHelp from './components/GetHelp';
import OtherSupport from './components/OtherSupport';

const SupportYouContainer = styled('div')`
const SupportContainer = styled('div')`
background-color: ${WHITE};
`;

Expand All @@ -24,13 +24,13 @@ const TilesContainer = styled('div')`

const SupportYou: React.FC = () => {
return (
<SupportYouContainer>
<SupportContainer>
<H2>How can we support you?</H2>
<TilesContainer>
<GetHelp />
<OtherSupport />
</TilesContainer>
</SupportYouContainer>
</SupportContainer>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Link from '@govuk-react/link';
import { H4, UnorderedList } from 'govuk-react';
import styled from 'styled-components';

import Tile from '../Tile';
import { Tile } from '../../../../components';

const StyledParagraph = styled('p')`
margin: ${SPACING_POINTS[4]}px 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from 'react';

import { SPACING_POINTS } from '@govuk-react/constants';
import { typography } from '@govuk-react/lib';
import Link from '@govuk-react/link';
import { H4 } from 'govuk-react';
import styled from 'styled-components';

import { Tile } from '../../../../components';

const StyledParagraph = styled('p')`
margin: 0 0 ${SPACING_POINTS[5]}px 0;
${typography.font({ size: 16 })};
&:last-child {
margin-bottom: 0;
}
`;

const hrefToSupport = `
https://data.trade.gov.uk/support-and-feedback/
`;
const hrefToCommunityChannel = `
https://teams.microsoft.com/l/team/19%3Ac1f08445f252403982e22a3
87b30b4ca%40thread.skype/conversations?groupId=748264d0-f2a0-4e
13-afa0-22c152ea7cb9&tenantId=8fa217ec-33aa-46fb-ad96-dfe68006b
b86
`;
const hrefToTeamsChannel = `
https://data-services-help.trade.gov.uk/data-workspace/updates/
`;

const OtherSupport: React.FC = () => {
return (
<Tile title="Other ways of support">
<H4 size={'SMALL'}>Message</H4>
<StyledParagraph>
<Link href={hrefToSupport}>Contact us</Link> if you have a question,
problem or suggestion.
</StyledParagraph>
<H4 size={'SMALL'}>Community</H4>
<StyledParagraph>
Join the{' '}
<Link href={hrefToCommunityChannel}>
Data Workspace community channel
</Link>{' '}
on Microsoft Teams to connect with colleagues.
</StyledParagraph>
<H4 size={'SMALL'}>Work</H4>
<StyledParagraph>
Find out what we are working on by visiting{' '}
<Link href={hrefToTeamsChannel}>What's new page</Link>
</StyledParagraph>
</Tile>
);
};

export default OtherSupport;
110 changes: 55 additions & 55 deletions dataworkspace/dataworkspace/static/js/stats/react_apps-stats.json
Original file line number Diff line number Diff line change
@@ -1,85 +1,85 @@
{
"status": "done",
"assets": {
"data-cut.7045d2b3ec8c90b61142.js": {
"name": "data-cut.7045d2b3ec8c90b61142.js",
"path": "data-cut.7045d2b3ec8c90b61142.js",
"publicPath": "/__django_static/js/bundles/data-cut.7045d2b3ec8c90b61142.js"
"data-cut.8325cefe01a5ba09d327.js": {
"name": "data-cut.8325cefe01a5ba09d327.js",
"path": "data-cut.8325cefe01a5ba09d327.js",
"publicPath": "/__django_static/js/bundles/data-cut.8325cefe01a5ba09d327.js"
},
"data-cut.7045d2b3ec8c90b61142.js.LICENSE.txt": {
"name": "data-cut.7045d2b3ec8c90b61142.js.LICENSE.txt",
"path": "data-cut.7045d2b3ec8c90b61142.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/data-cut.7045d2b3ec8c90b61142.js.LICENSE.txt"
"data-cut.8325cefe01a5ba09d327.js.LICENSE.txt": {
"name": "data-cut.8325cefe01a5ba09d327.js.LICENSE.txt",
"path": "data-cut.8325cefe01a5ba09d327.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/data-cut.8325cefe01a5ba09d327.js.LICENSE.txt"
},
"home-page.cd5e94fe0aa6a2519e83.js": {
"name": "home-page.cd5e94fe0aa6a2519e83.js",
"path": "home-page.cd5e94fe0aa6a2519e83.js",
"publicPath": "/__django_static/js/bundles/home-page.cd5e94fe0aa6a2519e83.js"
"home-page.69ad1290d9301736a900.js": {
"name": "home-page.69ad1290d9301736a900.js",
"path": "home-page.69ad1290d9301736a900.js",
"publicPath": "/__django_static/js/bundles/home-page.69ad1290d9301736a900.js"
},
"home-page.cd5e94fe0aa6a2519e83.js.LICENSE.txt": {
"name": "home-page.cd5e94fe0aa6a2519e83.js.LICENSE.txt",
"path": "home-page.cd5e94fe0aa6a2519e83.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/home-page.cd5e94fe0aa6a2519e83.js.LICENSE.txt"
"home-page.69ad1290d9301736a900.js.LICENSE.txt": {
"name": "home-page.69ad1290d9301736a900.js.LICENSE.txt",
"path": "home-page.69ad1290d9301736a900.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/home-page.69ad1290d9301736a900.js.LICENSE.txt"
},
"reference-dataset.6ef9c65e0b8fb280cfb4.js": {
"name": "reference-dataset.6ef9c65e0b8fb280cfb4.js",
"path": "reference-dataset.6ef9c65e0b8fb280cfb4.js",
"publicPath": "/__django_static/js/bundles/reference-dataset.6ef9c65e0b8fb280cfb4.js"
"reference-dataset.1c7a0378492a75c58f2a.js": {
"name": "reference-dataset.1c7a0378492a75c58f2a.js",
"path": "reference-dataset.1c7a0378492a75c58f2a.js",
"publicPath": "/__django_static/js/bundles/reference-dataset.1c7a0378492a75c58f2a.js"
},
"reference-dataset.6ef9c65e0b8fb280cfb4.js.LICENSE.txt": {
"name": "reference-dataset.6ef9c65e0b8fb280cfb4.js.LICENSE.txt",
"path": "reference-dataset.6ef9c65e0b8fb280cfb4.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/reference-dataset.6ef9c65e0b8fb280cfb4.js.LICENSE.txt"
"reference-dataset.1c7a0378492a75c58f2a.js.LICENSE.txt": {
"name": "reference-dataset.1c7a0378492a75c58f2a.js.LICENSE.txt",
"path": "reference-dataset.1c7a0378492a75c58f2a.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/reference-dataset.1c7a0378492a75c58f2a.js.LICENSE.txt"
},
"source-dataset.5125d85d094c65901bff.js": {
"name": "source-dataset.5125d85d094c65901bff.js",
"path": "source-dataset.5125d85d094c65901bff.js",
"publicPath": "/__django_static/js/bundles/source-dataset.5125d85d094c65901bff.js"
"source-dataset.2a80964648d265bb8ace.js": {
"name": "source-dataset.2a80964648d265bb8ace.js",
"path": "source-dataset.2a80964648d265bb8ace.js",
"publicPath": "/__django_static/js/bundles/source-dataset.2a80964648d265bb8ace.js"
},
"source-dataset.5125d85d094c65901bff.js.LICENSE.txt": {
"name": "source-dataset.5125d85d094c65901bff.js.LICENSE.txt",
"path": "source-dataset.5125d85d094c65901bff.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/source-dataset.5125d85d094c65901bff.js.LICENSE.txt"
"source-dataset.2a80964648d265bb8ace.js.LICENSE.txt": {
"name": "source-dataset.2a80964648d265bb8ace.js.LICENSE.txt",
"path": "source-dataset.2a80964648d265bb8ace.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/source-dataset.2a80964648d265bb8ace.js.LICENSE.txt"
},
"visualisations.075f927baa6dcfd40c82.js": {
"name": "visualisations.075f927baa6dcfd40c82.js",
"path": "visualisations.075f927baa6dcfd40c82.js",
"publicPath": "/__django_static/js/bundles/visualisations.075f927baa6dcfd40c82.js"
"visualisations.008e97864b4973ced8d8.js": {
"name": "visualisations.008e97864b4973ced8d8.js",
"path": "visualisations.008e97864b4973ced8d8.js",
"publicPath": "/__django_static/js/bundles/visualisations.008e97864b4973ced8d8.js"
},
"visualisations.075f927baa6dcfd40c82.js.LICENSE.txt": {
"name": "visualisations.075f927baa6dcfd40c82.js.LICENSE.txt",
"path": "visualisations.075f927baa6dcfd40c82.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/visualisations.075f927baa6dcfd40c82.js.LICENSE.txt"
"visualisations.008e97864b4973ced8d8.js.LICENSE.txt": {
"name": "visualisations.008e97864b4973ced8d8.js.LICENSE.txt",
"path": "visualisations.008e97864b4973ced8d8.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/visualisations.008e97864b4973ced8d8.js.LICENSE.txt"
},
"yourfiles.e2bc2c191bb58d5225cb.js": {
"name": "yourfiles.e2bc2c191bb58d5225cb.js",
"path": "yourfiles.e2bc2c191bb58d5225cb.js",
"publicPath": "/__django_static/js/bundles/yourfiles.e2bc2c191bb58d5225cb.js"
"your-files.d094751fcc1567801a41.js": {
"name": "your-files.d094751fcc1567801a41.js",
"path": "your-files.d094751fcc1567801a41.js",
"publicPath": "/__django_static/js/bundles/your-files.d094751fcc1567801a41.js"
},
"yourfiles.e2bc2c191bb58d5225cb.js.LICENSE.txt": {
"name": "yourfiles.e2bc2c191bb58d5225cb.js.LICENSE.txt",
"path": "yourfiles.e2bc2c191bb58d5225cb.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/yourfiles.e2bc2c191bb58d5225cb.js.LICENSE.txt"
"your-files.d094751fcc1567801a41.js.LICENSE.txt": {
"name": "your-files.d094751fcc1567801a41.js.LICENSE.txt",
"path": "your-files.d094751fcc1567801a41.js.LICENSE.txt",
"publicPath": "/__django_static/js/bundles/your-files.d094751fcc1567801a41.js.LICENSE.txt"
}
},
"chunks": {
"data-cut": [
"data-cut.7045d2b3ec8c90b61142.js"
"data-cut.8325cefe01a5ba09d327.js"
],
"home-page": [
"home-page.cd5e94fe0aa6a2519e83.js"
"home-page.69ad1290d9301736a900.js"
],
"reference-dataset": [
"reference-dataset.6ef9c65e0b8fb280cfb4.js"
"reference-dataset.1c7a0378492a75c58f2a.js"
],
"source-dataset": [
"source-dataset.5125d85d094c65901bff.js"
"source-dataset.2a80964648d265bb8ace.js"
],
"visualisations": [
"visualisations.075f927baa6dcfd40c82.js"
"visualisations.008e97864b4973ced8d8.js"
],
"yourfiles": [
"yourfiles.e2bc2c191bb58d5225cb.js"
"your-files": [
"your-files.d094751fcc1567801a41.js"
]
},
"publicPath": "/__django_static/js/bundles/"
Expand Down
Loading

0 comments on commit 6ebb2b8

Please sign in to comment.