2020-02-14 12:51:45 +01:00
|
|
|
<script>
|
2020-11-18 20:18:18 +01:00
|
|
|
import { getContext } from "svelte"
|
|
|
|
|
2021-06-11 12:37:05 +02:00
|
|
|
const { styleable, builderStore } = getContext("sdk")
|
2020-11-24 12:02:10 +01:00
|
|
|
const component = getContext("component")
|
2020-11-17 13:08:24 +01:00
|
|
|
|
2020-02-14 12:51:45 +01:00
|
|
|
export let type
|
2021-06-11 12:37:05 +02:00
|
|
|
export let text
|
|
|
|
|
|
|
|
$: placeholder = $builderStore.inBuilder && !text
|
|
|
|
$: componentText = $builderStore.inBuilder
|
|
|
|
? text || "Placeholder text"
|
|
|
|
: text || ""
|
2020-02-14 12:51:45 +01:00
|
|
|
</script>
|
|
|
|
|
2021-05-04 12:04:42 +02:00
|
|
|
{#if type === "h1"}
|
2021-06-11 12:37:05 +02:00
|
|
|
<h1 class:placeholder use:styleable={$component.styles}>{componentText}</h1>
|
2021-05-04 12:04:42 +02:00
|
|
|
{:else if type === "h2"}
|
2021-06-11 12:37:05 +02:00
|
|
|
<h2 class:placeholder use:styleable={$component.styles}>{componentText}</h2>
|
2021-05-04 12:04:42 +02:00
|
|
|
{:else if type === "h3"}
|
2021-06-11 12:37:05 +02:00
|
|
|
<h3 class:placeholder use:styleable={$component.styles}>{componentText}</h3>
|
2021-05-04 12:04:42 +02:00
|
|
|
{:else if type === "h4"}
|
2021-06-11 12:37:05 +02:00
|
|
|
<h4 class:placeholder use:styleable={$component.styles}>{componentText}</h4>
|
2021-05-04 12:04:42 +02:00
|
|
|
{:else if type === "h5"}
|
2021-06-11 12:37:05 +02:00
|
|
|
<h5 class:placeholder use:styleable={$component.styles}>{componentText}</h5>
|
2021-05-04 12:04:42 +02:00
|
|
|
{:else if type === "h6"}
|
2021-06-11 12:37:05 +02:00
|
|
|
<h6 class:placeholder use:styleable={$component.styles}>{componentText}</h6>
|
2020-02-14 12:51:45 +01:00
|
|
|
{/if}
|
2021-02-23 11:02:21 +01:00
|
|
|
|
|
|
|
<style>
|
|
|
|
h1,
|
|
|
|
h2,
|
|
|
|
h3,
|
|
|
|
h4,
|
|
|
|
h5,
|
|
|
|
h6 {
|
|
|
|
white-space: pre-wrap;
|
|
|
|
}
|
2021-06-11 12:37:05 +02:00
|
|
|
|
|
|
|
.placeholder {
|
|
|
|
font-style: italic;
|
|
|
|
color: var(--grey-6);
|
|
|
|
}
|
2021-02-23 11:02:21 +01:00
|
|
|
</style>
|