Skip to content

Commit 8851e91

Browse files
committed
Sync up NHSLogo fallback image with nhsuk-frontend
1 parent a6e3fba commit 8851e91

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/components/header/components/NHSLogo.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
import React, { useContext, HTMLProps } from 'react';
1+
import React, { useContext, HTMLProps, SVGProps } from 'react';
22
import classNames from 'classnames';
33
import HeaderContext, { IHeaderContext } from '../HeaderContext';
44

5+
interface SVGImageWithSrc extends SVGProps<SVGImageElement> {
6+
src: string;
7+
}
8+
9+
const SVGImageWithSrc: React.FC<SVGImageWithSrc> = props => <image {...props} />;
10+
511
const NHSLogo: React.FC<HTMLProps<HTMLAnchorElement>> = ({ className, alt, ...rest }) => {
612
const { serviceName, hasMenuToggle, hasSearch } = useContext<IHeaderContext>(HeaderContext);
713
return (
@@ -27,12 +33,12 @@ const NHSLogo: React.FC<HTMLProps<HTMLAnchorElement>> = ({ className, alt, ...re
2733
aria-labelledby="nhsuk-logo_title"
2834
>
2935
<title id="nhsuk-logo_title">{alt}</title>
30-
<path className="nhsuk-logo__background" d="M0 0h40v16H0z"></path>
36+
<path className="nhsuk-logo__background" d="M0 0h40v16H0z" />
3137
<path
3238
className="nhsuk-logo__text"
3339
d="M3.9 1.5h4.4l2.6 9h.1l1.8-9h3.3l-2.8 13H9l-2.7-9h-.1l-1.8 9H1.1M17.3 1.5h3.6l-1 4.9h4L25 1.5h3.5l-2.7 13h-3.5l1.1-5.6h-4.1l-1.2 5.6h-3.4M37.7 4.4c-.7-.3-1.6-.6-2.9-.6-1.4 0-2.5.2-2.5 1.3 0 1.8 5.1 1.2 5.1 5.1 0 3.6-3.3 4.5-6.4 4.5-1.3 0-2.9-.3-4-.7l.8-2.7c.7.4 2.1.7 3.2.7s2.8-.2 2.8-1.5c0-2.1-5.1-1.3-5.1-5 0-3.4 2.9-4.4 5.8-4.4 1.6 0 3.1.2 4 .6"
34-
></path>
35-
<img src="https://assets.nhs.uk/images/nhs-logo.png" alt={alt}/>
40+
/>
41+
<SVGImageWithSrc src="https://assets.nhs.uk/images/nhs-logo.png" xlinkHref="" />
3642
</svg>
3743
{serviceName ? <span className="nhsuk-header__service-name">{serviceName}</span> : null}
3844
</a>
@@ -42,7 +48,7 @@ const NHSLogo: React.FC<HTMLProps<HTMLAnchorElement>> = ({ className, alt, ...re
4248

4349
NHSLogo.defaultProps = {
4450
'aria-label': 'NHS homepage',
45-
'alt': 'NHS Logo',
51+
alt: 'NHS Logo',
4652
};
4753

4854
export default NHSLogo;

0 commit comments

Comments
 (0)