-
Notifications
You must be signed in to change notification settings - Fork 9
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
Header: Support custom logos #1281
base: master
Are you sure you want to change the base?
Header: Support custom logos #1281
Conversation
0d947ff
to
0186674
Compare
…to be added chore: add test cases to the Header component to support testing the logo prop fix: remove unused import
0186674
to
6eb6963
Compare
components/header/src/Header.tsx
Outdated
@@ -94,6 +96,7 @@ export const Header: FC<HeaderProps> = ({ | |||
serviceName, | |||
signOutHref, | |||
signOutText = 'Sign out', | |||
logo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would slightly prefer logo: _logo,
as that's a style we use elsewhere.
But that's purely stylistic, and I'm happy to fix that later if it doesn't make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to align with your coding standards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been updated
… test case to mock the <CrownLogo> and <CoatLogo> components
expect(screen.getByTestId('custom-logo')).toBeInTheDocument() | ||
expect(screen.queryByTestId('crownLogo')).not.toBeInTheDocument() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect there will be a way to do this with getByRole('img')
and maybe getByLabelText()
but it's not a big deal and I'm happy to have a dig around later.
Co-authored-by: Daniel A.C. Martin <daniel-ac-martin@users.noreply.github.com>
Co-authored-by: Daniel A.C. Martin <daniel-ac-martin@users.noreply.github.com>
Co-authored-by: Daniel A.C. Martin <daniel-ac-martin@users.noreply.github.com>
Co-authored-by: Daniel A.C. Martin <daniel-ac-martin@users.noreply.github.com>
This feature adds the ability to override the logo displayed in the
Header
component.Different government organisations have different logo requirements including removing the header logo altogether
To pass in a different header logo simply add the
logo
prop to theHeader
component and pass in anyReactNode
, or pass innull
to remove the logo altogether.Note that thegovUK={true}
prop will take precedence over the custom logo.Example usage: