1
0
Fork 0
mirror of synced 2024-08-21 13:01:47 +12:00
budibase/packages/standard-components/src/StackedList.svelte

85 lines
1.5 KiB
Svelte
Raw Normal View History

2020-07-31 23:02:29 +12:00
<script>
import { getContext } from "svelte"
const { styleable } = getContext("sdk")
const component = getContext("component")
2020-07-31 23:02:29 +12:00
export let imageUrl = ""
export let heading = ""
export let subheading = ""
2020-07-31 23:02:29 +12:00
export let destinationUrl = ""
$: showImage = !!imageUrl
</script>
<div class="container" use:styleable={$component.styles}>
2020-07-31 23:02:29 +12:00
<a href={destinationUrl}>
<div class="stackedlist">
2020-07-31 23:02:29 +12:00
{#if showImage}
<div class="image-block">
<img class="image" src={imageUrl} alt="" />
</div>
{/if}
<div class="content">
<div class="heading">{heading}</div>
<div class="subheading">{subheading}</div>
</div>
2020-07-31 23:02:29 +12:00
</div>
</a>
</div>
<style>
a {
text-decoration: none;
color: inherit;
cursor: pointer;
2020-07-31 23:02:29 +12:00
}
.container {
padding: 1rem 1.5rem;
min-height: 3rem;
display: block;
align-items: flex-start;
2020-07-31 23:02:29 +12:00
}
.stackedlist {
2020-07-31 23:02:29 +12:00
display: flex;
flex-direction: row;
overflow: hidden;
max-width: 100%;
2020-07-31 23:02:29 +12:00
}
.subheading {
opacity: 0.6;
white-space: pre-wrap;
2020-07-31 23:02:29 +12:00
}
.content {
min-width: 0;
max-width: 100%;
flex: 1 1 auto;
2020-07-31 23:02:29 +12:00
}
.heading {
font-weight: 600;
white-space: pre-wrap;
2020-07-31 23:02:29 +12:00
}
.image-block {
display: flex;
flex: 0 0 auto;
margin-right: 1.5rem;
color: inherit;
text-decoration: none;
2020-07-31 23:02:29 +12:00
}
.image {
display: block;
overflow: hidden;
width: 3rem;
max-width: 100%;
-webkit-user-select: none;
user-select: none;
border-radius: 99px;
2020-07-31 23:02:29 +12:00
}
</style>