Add placeholder to background image, fix default styles and add size styles
This commit is contained in:
parent
86da3b7f28
commit
748938b1f0
|
@ -742,6 +742,7 @@
|
||||||
"name": "Background Image",
|
"name": "Background Image",
|
||||||
"description": "A background image",
|
"description": "A background image",
|
||||||
"icon": "Images",
|
"icon": "Images",
|
||||||
|
"styles": ["size"],
|
||||||
"illegalChildren": ["section"],
|
"illegalChildren": ["section"],
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { getContext } from "svelte"
|
import { getContext } from "svelte"
|
||||||
|
import Placeholder from "./Placeholder.svelte"
|
||||||
|
|
||||||
const { styleable } = getContext("sdk")
|
const { styleable } = getContext("sdk")
|
||||||
const component = getContext("component")
|
const component = getContext("component")
|
||||||
|
@ -18,13 +19,24 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="outer" use:styleable={$component.styles}>
|
{#if url}
|
||||||
<div class="inner" {style} />
|
<div class="outer" use:styleable={$component.styles}>
|
||||||
</div>
|
<div class="inner" {style} />
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div
|
||||||
|
class="placeholder"
|
||||||
|
use:styleable={{ ...$component.styles, empty: true }}
|
||||||
|
>
|
||||||
|
<Placeholder />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.outer {
|
.outer {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inner {
|
.inner {
|
||||||
|
@ -35,4 +47,11 @@
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center center;
|
background-position: center center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.placeholder {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
height: 75px;
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue