2020-02-20 18:06:50 +01:00
|
|
|
<script>
|
|
|
|
|
2020-02-21 12:43:21 +01:00
|
|
|
import { cssVars, createClasses } from "./cssVars"
|
|
|
|
|
2020-02-20 18:06:50 +01:00
|
|
|
export let url = ""
|
|
|
|
export let text = ""
|
|
|
|
export let openInNewTab = false
|
2020-02-21 12:43:21 +01:00
|
|
|
export let color
|
|
|
|
export let hoverColor
|
|
|
|
export let underline = false
|
|
|
|
export let fontSize
|
2020-02-20 18:06:50 +01:00
|
|
|
|
|
|
|
export let _bb
|
|
|
|
|
|
|
|
let anchorElement
|
|
|
|
|
|
|
|
$: anchorElement && !text && _bb.attachChildren(anchorElement)
|
|
|
|
$: target = openInNewTab ? "_blank" : "_self"
|
2020-02-21 12:43:21 +01:00
|
|
|
$: cssVariables = {
|
|
|
|
hoverColor,
|
|
|
|
color,
|
|
|
|
textDecoration: underline ? "underline" : "none",
|
|
|
|
fontSize
|
|
|
|
}
|
|
|
|
$: classes = createClasses(cssVariables)
|
2020-02-20 18:06:50 +01:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
2020-02-21 12:43:21 +01:00
|
|
|
<a
|
|
|
|
href={url}
|
|
|
|
bind:this={anchorElement}
|
|
|
|
class={classes}
|
|
|
|
target={target}
|
|
|
|
use:cssVars={cssVariables}>{text}</a>
|
|
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
|
|
|
.color {
|
|
|
|
color: var(--color)
|
|
|
|
}
|
|
|
|
|
|
|
|
.hoverColor:hover {
|
|
|
|
color: var(--color)
|
|
|
|
}
|
|
|
|
|
|
|
|
.textDecoration {
|
|
|
|
text-decoration: var(--textDecoration)
|
|
|
|
}
|
|
|
|
|
|
|
|
.fontSize {
|
|
|
|
font-size: var(--fontSize)
|
|
|
|
}
|
2020-02-20 18:06:50 +01:00
|
|
|
|
2020-02-21 12:43:21 +01:00
|
|
|
</style>
|
2020-02-20 18:06:50 +01:00
|
|
|
|