2018-01-29 05:07:31 +00:00
|
|
|
<a rel="nofollow noopener"
|
|
|
|
target="_blank"
|
2018-05-02 00:05:36 +00:00
|
|
|
{href}
|
|
|
|
aria-label={ariaLabel}
|
2018-08-26 22:38:45 +00:00
|
|
|
class={computedClass}>
|
2018-05-02 00:05:36 +00:00
|
|
|
<slot></slot>{#if showIcon}
|
2019-03-03 03:02:06 +00:00
|
|
|
<SvgIcon className="external-link-svg" href="#fa-external-link" />
|
2018-05-02 00:05:36 +00:00
|
|
|
{/if}</a>
|
2018-01-29 03:01:51 +00:00
|
|
|
<style>
|
2018-01-29 05:07:31 +00:00
|
|
|
.external-link-with-icon {
|
2018-01-29 03:01:51 +00:00
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
2019-03-03 03:02:06 +00:00
|
|
|
:global(.external-link-with-icon .external-link-svg) {
|
2018-01-29 03:01:51 +00:00
|
|
|
margin-left: 4px;
|
|
|
|
width: 14px;
|
|
|
|
height: 14px;
|
|
|
|
fill: var(--deemphasized-text-color);
|
|
|
|
}
|
2019-03-03 03:02:06 +00:00
|
|
|
:global(.external-link-with-icon.normal-icon-color .external-link-svg) {
|
2018-02-10 22:35:21 +00:00
|
|
|
fill: var(--body-text-color);
|
|
|
|
}
|
2018-04-30 05:13:41 +00:00
|
|
|
</style>
|
|
|
|
<script>
|
2018-08-26 22:38:45 +00:00
|
|
|
import { classname } from '../_utils/classname'
|
2019-03-03 03:02:06 +00:00
|
|
|
import SvgIcon from './SvgIcon.html'
|
2018-08-26 22:38:45 +00:00
|
|
|
|
2018-04-30 05:13:41 +00:00
|
|
|
export default {
|
|
|
|
data: () => ({
|
2018-04-30 16:57:49 +00:00
|
|
|
className: void 0,
|
|
|
|
normalIconColor: false,
|
|
|
|
ariaLabel: '',
|
|
|
|
showIcon: false
|
2018-08-26 22:38:45 +00:00
|
|
|
}),
|
|
|
|
computed: {
|
|
|
|
computedClass: ({ className, showIcon, normalIconColor }) => (classname(
|
|
|
|
'external-link',
|
|
|
|
className,
|
|
|
|
showIcon && 'external-link-with-icon',
|
|
|
|
normalIconColor && 'normal-icon-color'
|
|
|
|
))
|
2019-03-03 03:02:06 +00:00
|
|
|
},
|
|
|
|
components: {
|
|
|
|
SvgIcon
|
2018-08-26 22:38:45 +00:00
|
|
|
}
|
2018-04-30 05:13:41 +00:00
|
|
|
}
|
2019-03-03 03:02:06 +00:00
|
|
|
</script>
|