2020-08-13 09:58:48 +02:00
|
|
|
<script>
|
2020-11-18 22:06:12 +01:00
|
|
|
import { getContext } from "svelte"
|
2020-08-13 09:58:48 +02:00
|
|
|
|
2021-02-11 12:35:52 +01:00
|
|
|
const { styleable, linkable } = getContext("sdk")
|
2020-11-24 12:02:10 +01:00
|
|
|
const component = getContext("component")
|
2020-11-18 22:06:12 +01:00
|
|
|
|
2020-08-13 11:54:43 +02:00
|
|
|
export const className = ""
|
2020-08-13 09:58:48 +02:00
|
|
|
export let imageUrl = ""
|
|
|
|
export let heading = ""
|
|
|
|
export let description = ""
|
|
|
|
export let linkText = ""
|
|
|
|
export let linkUrl
|
2020-12-09 13:21:04 +01:00
|
|
|
export let linkColor
|
2020-08-13 09:58:48 +02:00
|
|
|
export let linkHoverColor
|
|
|
|
export let imageHeight
|
|
|
|
export let cardWidth
|
|
|
|
|
2021-01-14 16:39:50 +01:00
|
|
|
$: cardStyles = {
|
|
|
|
...$component.styles,
|
|
|
|
normal: {
|
|
|
|
...$component.styles.normal,
|
|
|
|
width: cardWidth,
|
|
|
|
},
|
2020-08-13 09:58:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$: showImage = !!imageUrl
|
|
|
|
</script>
|
|
|
|
|
2021-01-14 16:39:50 +01:00
|
|
|
<div class="container" use:styleable={cardStyles}>
|
2020-12-10 12:11:53 +01:00
|
|
|
{#if showImage}
|
|
|
|
<img
|
2021-01-14 16:39:50 +01:00
|
|
|
style="--imageHeight: {imageHeight}"
|
2020-12-10 12:11:53 +01:00
|
|
|
class="image"
|
|
|
|
src={imageUrl}
|
|
|
|
alt="" />
|
|
|
|
{/if}
|
2020-08-13 09:58:48 +02:00
|
|
|
<div class="content">
|
|
|
|
<h2 class="heading">{heading}</h2>
|
|
|
|
<h4 class="text">{description}</h4>
|
2020-12-10 12:11:53 +01:00
|
|
|
<a
|
2021-02-11 12:35:52 +01:00
|
|
|
use:linkable
|
2020-12-10 12:11:53 +01:00
|
|
|
style="--linkColor: {linkColor}; --linkHoverColor: {linkHoverColor}"
|
2021-02-23 11:14:54 +01:00
|
|
|
href={linkUrl || '/'}>
|
2021-02-11 12:35:52 +01:00
|
|
|
{linkText}
|
|
|
|
</a>
|
2020-08-13 09:58:48 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.container {
|
|
|
|
width: var(--cardWidth);
|
|
|
|
overflow: hidden !important;
|
|
|
|
height: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.image {
|
|
|
|
width: 100% !important;
|
|
|
|
max-width: 100%;
|
|
|
|
height: var(--imageHeight);
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
|
|
|
padding: 1.5rem;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
gap: 1rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.heading {
|
|
|
|
font-size: 1.25rem;
|
|
|
|
font-weight: 700;
|
|
|
|
margin: 0;
|
2021-02-23 11:14:54 +01:00
|
|
|
white-space: pre-wrap;
|
2020-08-13 09:58:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.text {
|
|
|
|
font-size: 1rem;
|
|
|
|
margin: 0;
|
|
|
|
font-weight: 400;
|
|
|
|
line-height: 1.5rem;
|
2021-02-23 11:14:54 +01:00
|
|
|
white-space: pre-wrap;
|
2020-08-13 09:58:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
a {
|
|
|
|
margin: 0.5rem 0;
|
|
|
|
text-decoration: none;
|
2020-12-09 13:21:04 +01:00
|
|
|
color: var(--linkColor);
|
2020-08-13 09:58:48 +02:00
|
|
|
font-weight: 600;
|
2021-02-23 11:14:54 +01:00
|
|
|
white-space: pre-wrap;
|
2020-08-13 09:58:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
a:hover {
|
|
|
|
color: var(--linkHoverColor);
|
|
|
|
}
|
|
|
|
</style>
|