1
0
Fork 0
mirror of synced 2024-07-08 15:56:23 +12:00
budibase/packages/standard-components/src/CardHorizontal.svelte

109 lines
2 KiB
Svelte
Raw Normal View History

2020-08-13 19:58:48 +12:00
<script>
import { getContext } from "svelte"
2020-08-13 19:58:48 +12:00
const { styleable } = getContext("sdk")
const component = getContext("component")
2020-08-13 21:54:43 +12:00
export const className = ""
2020-08-13 19:58:48 +12:00
export let imageUrl = ""
export let heading = ""
export let description = ""
export let subtext = ""
export let linkText = ""
export let linkUrl
export let linkColor
2020-08-13 19:58:48 +12:00
export let linkHoverColor
export let cardWidth
export let imageWidth
export let imageHeight
$: showImage = !!imageUrl
</script>
<div
2020-12-10 03:12:10 +13:00
use:styleable={$component.styles}
class="container"
style="--cardWidth: {cardWidth}">
{#if showImage}
<img
style="--imageWidth: {imageWidth}; --imageHeight: {imageHeight}"
class="image"
src={imageUrl}
alt="" />
{/if}
2020-08-13 19:58:48 +12:00
<div class="content">
<main>
<h2 class="heading">{heading}</h2>
<p class="text">{description}</p>
</main>
<footer>
2020-08-13 19:58:48 +12:00
<p class="subtext">{subtext}</p>
<a
style="--linkColor: {linkColor}; --linkHoverColor: {linkHoverColor}"
href={linkUrl}>{linkText}</a>
2020-08-13 19:58:48 +12:00
</footer>
</div>
</div>
<style>
.container {
height: 100%;
max-width: var(--cardWidth);
display: flex !important;
text-align: left;
}
.image {
width: var(--imageWidth);
height: var(--imageHeight);
vertical-align: middle;
}
.content {
display: flex;
flex-direction: column;
justify-content: space-between;
width: 100%;
padding: 0.85rem 1.5rem;
}
.heading {
font-size: 1rem;
font-weight: 700;
margin: 0;
}
.text {
font-size: 0.85rem;
margin: 0.5rem 0 0 0;
font-weight: 400;
line-height: 1.25rem;
}
footer {
display: flex;
justify-content: space-between;
align-items: baseline;
}
.subtext {
font-size: 0.85rem;
margin: 0;
font-weight: 400;
2020-08-13 21:45:25 +12:00
color: #757575;
2020-08-13 19:58:48 +12:00
}
a {
margin: 0.5rem 0 0 0;
text-decoration: none;
color: var(--linkColor);
2020-08-13 19:58:48 +12:00
font-weight: 600;
font-size: 0.85rem;
margin: 0;
}
a:hover {
color: var(--linkHoverColor);
}
</style>