2020-02-14 12:51:45 +01:00
|
|
|
<script>
|
2020-04-27 12:26:34 +02:00
|
|
|
import { buildStyle } from "./buildStyle.js"
|
2020-02-14 12:51:45 +01:00
|
|
|
export let className = ""
|
|
|
|
export let type
|
|
|
|
export let _bb
|
2020-04-22 12:52:55 +02:00
|
|
|
export let text = ""
|
2020-04-27 12:26:34 +02:00
|
|
|
export let fontFamily = ""
|
2020-04-29 16:49:51 +02:00
|
|
|
export let color = ""
|
2020-04-27 12:26:34 +02:00
|
|
|
|
2020-02-14 12:51:45 +01:00
|
|
|
let containerElement
|
|
|
|
|
2020-04-22 12:52:55 +02:00
|
|
|
$: containerElement && !text && _bb.attachChildren(containerElement)
|
2020-04-29 16:49:51 +02:00
|
|
|
$: style = buildStyle({ "font-family": fontFamily, color })
|
|
|
|
// $: console.log("HEADING", color)
|
2020-02-14 12:51:45 +01:00
|
|
|
</script>
|
|
|
|
|
2020-02-25 16:21:23 +01:00
|
|
|
{#if type === 'h1'}
|
2020-04-27 12:26:34 +02:00
|
|
|
<h1 class={className} {style} bind:this={containerElement}>{text}</h1>
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'h2'}
|
2020-04-27 12:26:34 +02:00
|
|
|
<h2 class={className} {style} bind:this={containerElement}>{text}</h2>
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'h3'}
|
2020-04-27 12:26:34 +02:00
|
|
|
<h3 class={className} {style} bind:this={containerElement}>{text}</h3>
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'h4'}
|
2020-04-27 12:26:34 +02:00
|
|
|
<h4 class={className} {style} bind:this={containerElement}>{text}</h4>
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'h5'}
|
2020-04-27 12:26:34 +02:00
|
|
|
<h5 class={className} {style} bind:this={containerElement}>{text}</h5>
|
2020-02-25 16:21:23 +01:00
|
|
|
{:else if type === 'h6'}
|
2020-04-27 12:26:34 +02:00
|
|
|
<h6 class={className} {style} bind:this={containerElement}>{text}</h6>
|
2020-02-14 12:51:45 +01:00
|
|
|
{/if}
|