1- import React , { useContext , HTMLProps } from 'react' ;
1+ import React , { useContext , HTMLProps , SVGProps } from 'react' ;
22import classNames from 'classnames' ;
33import 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+
511const NHSLogo : React . FC < HTMLProps < HTMLAnchorElement > > = ( { className, alt, ...rest } ) => {
612 const { serviceName, hasMenuToggle, hasSearch } = useContext < IHeaderContext > ( HeaderContext ) ;
713 return (
@@ -21,7 +27,7 @@ const NHSLogo: React.FC<HTMLProps<HTMLAnchorElement>> = ({ className, alt, ...re
2127 < svg
2228 className = "nhsuk-logo"
2329 xmlns = "http://www.w3.org/2000/svg"
24- role = "presentation "
30+ role = "img "
2531 focusable = "false"
2632 viewBox = "0 0 40 16"
2733 aria-labelledby = "nhsuk-logo_title"
@@ -32,7 +38,7 @@ const NHSLogo: React.FC<HTMLProps<HTMLAnchorElement>> = ({ className, alt, ...re
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"
3440 />
35- < img src = "https://assets.nhs.uk/images/nhs-logo.png" alt = { alt } />
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 >
0 commit comments