Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PRMP-1330] - Add service-updates-link to footer #491

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { render, screen } from '@testing-library/react';
import ServiceUpdatesLink from './ServiceUpdatesLink';

describe('Service updates link', () => {
it('renders a service updates link that opens in a new tab', () => {
render(<ServiceUpdatesLink />);

const serviceUpdatesLink = screen.getByRole('link', {
name: /Service updates/i,
});

expect(serviceUpdatesLink).toHaveAttribute(
'href',
'https://digital.nhs.uk/services/access-and-store-digital-patient-documents/service-updates',
);
expect(serviceUpdatesLink).toHaveAttribute('target', '_blank');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Footer as NHSFooter } from 'nhsuk-react-components';

const ServiceUpdatesLink = () => {
return (
<NHSFooter.ListItem
href="https://digital.nhs.uk/services/access-and-store-digital-patient-documents/service-updates"
data-testid="service-updates-link"
rel="noopener"
target="_blank"
aria-label="(Service updates - Opens in a new tab)"
steph-torres-nhs marked this conversation as resolved.
Show resolved Hide resolved
>
Service updates
</NHSFooter.ListItem>
);
};

export default ServiceUpdatesLink;
2 changes: 2 additions & 0 deletions app/src/components/layout/footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { Footer as NHSFooter } from 'nhsuk-react-components';
import { routes } from '../../../types/generic/routes';
import ServiceUpdatesLink from '../../generic/serviceUpdatesLink/ServiceUpdatesLink';

function Footer() {
return (
Expand All @@ -15,6 +16,7 @@ function Footer() {
>
Privacy notice
</NHSFooter.ListItem>
<ServiceUpdatesLink />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed I was wondering if it would be worth making the <NHSFooter.ListItem for ServiceUpdatesLink in the same file rather than separate one like the privacy link Footer list item. This might help with consistency especially since the ServiceUpdatesLink might not be usable in other places as its made as a NHSFooter.listitem

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have modified this to no longer use a component but rather a constant within the Footer.tsx

</NHSFooter.List>
<NHSFooter.Copyright>&copy; {'Crown copyright'}</NHSFooter.Copyright>
</NHSFooter>
Expand Down
Loading