Update organisation switcher link logic #67
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
It will display:
![image](https://user-images.githubusercontent.com/3327997/62639023-9161f780-b936-11e9-8949-ab43cd49d50d.png)
Fixes #66