pinafore/routes/_components/ExternalLink.html

30 lines
661 B
HTML
Raw Normal View History

2018-01-29 06:07:31 +01:00
<a rel="nofollow noopener"
target="_blank"
href="{{href}}"
class="{{className || ''}} {{showIcon ? 'external-link-with-icon' : ''}}">
<slot></slot>
{{#if showIcon}}
<svg>
<use xlink:href="#fa-external-link" />
</svg>
{{/if}}
</a>
2018-01-29 04:01:51 +01:00
<style>
2018-01-29 06:07:31 +01:00
.external-link-with-icon {
2018-01-29 04:01:51 +01:00
display: inline-flex;
align-items: center;
}
2018-01-29 06:07:31 +01:00
.external-link-with-icon svg {
2018-01-29 04:01:51 +01:00
margin-left: 4px;
width: 14px;
height: 14px;
fill: var(--deemphasized-text-color);
}
2018-01-29 06:07:31 +01:00
</style>
<script>
export default {
oncreate() {
this.set({className: this.get('class')}) // workaround for "class" property name bug in svelte
}
}
</script>