1
0
Fork 0
mirror of synced 2024-09-28 15:21:28 +12:00
budibase/packages/standard-components/src/BackgroundImage.svelte

29 lines
553 B
Svelte
Raw Normal View History

2021-02-26 22:58:11 +13:00
<script>
import { getContext } from "svelte"
const { styleable } = getContext("sdk")
const component = getContext("component")
export let url = ""
$: style = url ? `background-image: url("${url}")` : ""
</script>
<div class="outer" use:styleable={$component.styles}>
<div class="inner" {style} />
</div>
<style>
.outer {
position: relative;
}
.inner {
position: absolute;
height: 100%;
width: 100%;
background-repeat: no-repeat;
background-size: cover;
2021-02-27 03:04:44 +13:00
background-position: center center;
2021-02-26 22:58:11 +13:00
}
</style>