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

Update organisation switcher link logic #67

Merged
merged 1 commit into from
Aug 8, 2019

Conversation

teneightfive
Copy link
Contributor

Identify the bug

#66

Description of the change

Only display the organisation switcher link if a link object is
passed to the component.

This prevents an empty link tag being output to the source if there
is no link destination.

This change still supports the fallback text as long as a link href
is supplied.

It also updates the example to show how the component will look
without a change link and with the fallback link text.

Possible drawbacks

This removes the ability to add HTML inside the link element. I can't see why we would want to accept HTML inside this particular element though and it felt like this implementation may have been copied from other components that may have a specific need for it. Where possible we should be limiting the amount of locations input can be marked as safe and displayed as HTML.

What it looks like now

With this configuration:

{{ mojOrganisationSwitcher({
  text: 'HMP Brixton'
}) }}

It will display:
image

Fixes #66

@teneightfive teneightfive self-assigned this Aug 7, 2019
@simonwhatley simonwhatley temporarily deployed to moj-frontend-staging-pr-67 August 7, 2019 16:14 Inactive
Only display the organisation switcher link if a link object is
passed to the component.

This prevents an empty link tag being output to the source if there
is no link destination.

This change still supports the fallback text as long as a link `href`
is supplied.

It also updates the example to show how the component will look
without a change link and with the fallback link text.
@adamsilver adamsilver merged commit 72b77df into master Aug 8, 2019
@adamsilver
Copy link
Contributor

adamsilver commented Aug 8, 2019

Thanks @teneightfive — will be ready when we next publish to NPM.

@simonwhatley simonwhatley deleted the component/organisation-switcher branch August 15, 2019 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Organisation switcher output link element when no link is supplied
3 participants