Smart card - Link url
We want to warn users if a link description text looks like a URL but the actual link destination is different.
For instance, the link like this www.atlassian.com, (opens new window) leads to the google.com instead of expected www.atlassian.com
<a href="https://www.google.com/" ...>www.atlassian.com</a>
LinkUrl component has a built-in safety check and can be used as a plain hyperlink tag where we want to have a link safety check.
Note that when the checkSafety is true we only call the onClick function when the link is safe. If you would like to ensure that the onClick is always called then you can disable the safety checking by setting the safetyCheck to false. This is because onClick is often used to programatically open a link in a new tab or window and we don't want the links to open until we have checked that they are safe.
Installation
yarn add @atlaskit/smart-card
Simple usage
import LinkUrl from '@atlaskit/smart-card/link-url';
<LinkUrl href='https://www.google.com/ safetyCheck={true} >
www.atlassian.com
</LinkUrl>
Please, click on the link below to see the warning message.
www.atlassian.comLink safety warning
- Link description is a URL and it's different from a destination.
atlassian.com
No link safety warning
- Link description is a plain text.
Here is a google link - Link description is a URL identical to a destination.
https://www.atlassian.com/solutions/devops - Link is a multi-line URL.
Help
https://www.atlassian.com/solutions/devops - Link is a multi-line URL.Helphttps://hello.atlas...