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 <KExternalLink> with icon and noopener noreferrer attr #142

Merged
merged 13 commits into from
Jan 5, 2021
25 changes: 10 additions & 15 deletions lib/buttons-and-links/KExternalLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,18 @@
:class="buttonClasses"
:href="href"
:download="download"
:openInNewTab="openInNewTab"
:target="openInNewTab ? '_blank' : false"
rel="noopener noreferrer"
dir="auto"
@mouseenter="hovering = true"
@mouseleave="hovering = false"
>
<slot name="icon">
<KIcon
v-if="icon"
:icon="icon"
style="top: 4px;"
:color="hovering ? $themeTokens.primaryDark : $themeTokens.primary"
/>
</slot>
<span class="link-text" :style="spanStyle">{{ text }}</span>
<slot name="iconAfter">
<slot name="openInNewTab">
<KIcon
v-if="iconAfter"
:icon="iconAfter"
v-if="openInNewTab"
icon="openNewTab"
style="top: 4px;"
:color="hovering ? $themeTokens.primaryDark : $themeTokens.primary"
/>
Expand Down Expand Up @@ -64,11 +59,11 @@
required: false,
},
/**
* If provided, shows a KIcon after the text
* If provided, opens link in new tab
sairina marked this conversation as resolved.
Show resolved Hide resolved
*/
iconAfter: {
type: String,
required: false,
openInNewTab: {
type: Boolean,
default: false,
},
},
data() {
Expand Down