Skip to content

Commit

Permalink
Ensure to always use "blank" target for external links
Browse files Browse the repository at this point in the history
This commit adds the `_blank` value for the `target` property of the
`Link` component to ensure external URLs are always opened in a new
tab/window to keep Nord Docs open.

GH-132
  • Loading branch information
arcticicestudio committed Mar 16, 2019
1 parent 10a78bf commit a58720b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const A = ({ children, href, to, linkRef, ...passProps }) =>
{children}
</BaseGatsbyLink>
) : (
<BaseComponent ref={linkRef} href={href || to} {...passProps}>
<BaseComponent ref={linkRef} href={href || to} target="_blank" {...passProps}>
{children}
</BaseComponent>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ exports[`logical behavior renders external URLs with \`href\` prop 1`] = `
<a
class="c0 c1"
href="https://www.nordtheme.com"
target="_blank"
>
Nord
</a>
Expand Down Expand Up @@ -151,6 +152,7 @@ exports[`logical behavior renders external URLs with \`to\` prop 1`] = `
<a
class="c0 c1"
href="https://www.nordtheme.com"
target="_blank"
>
Nord
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ exports[`theme styles matches the snapshot with \`calmly\` variant 1`] = `
<a
class="c0 c1"
href=""
target="_blank"
>
Nord
</a>
Expand Down Expand Up @@ -68,6 +69,7 @@ exports[`theme styles matches the snapshot with \`decent\` variant 1`] = `
<a
class="c0 c1"
href=""
target="_blank"
>
Nord
</a>
Expand Down Expand Up @@ -103,6 +105,7 @@ exports[`theme styles matches the snapshot with \`minimal\` variant 1`] = `
<a
class="c0 c1"
href=""
target="_blank"
>
Nord
</a>
Expand Down Expand Up @@ -140,6 +143,7 @@ exports[`theme styles matches the snapshot with default variant 1`] = `
<a
class="c0 c1"
href=""
target="_blank"
>
Nord
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ exports[`logical behavior renders external URLs with \`href\` prop 1`] = `
<a
class="c0"
href="https://www.nordtheme.com"
target="_blank"
>
Docs
</a>
Expand All @@ -41,6 +42,7 @@ exports[`logical behavior renders external URLs with \`to\` prop 1`] = `
<a
class="c0"
href="https://www.nordtheme.com"
target="_blank"
>
Docs
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ exports[`theme styles matches the snapshot 1`] = `
<a
class="c0 c1"
href=""
target="_blank"
>
Nord
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ exports[`theme styles matches the snapshot 1`] = `
class="c0 c1"
href=""
style="opacity: 0; transform: none;"
target="_blank"
>
Nord
</a>
Expand Down

0 comments on commit a58720b

Please sign in to comment.