Use svelte:element to avoid tag conditions

This commit is contained in:
2022-06-22 23:17:37 +02:00
parent cce0e5d9c2
commit 33487cba5c

View File

@@ -56,28 +56,11 @@
bind:innerWidth bind:innerHeight bind:innerWidth bind:innerHeight
/> />
{#if tag === 'h1'} <svelte:element this={tag}
<h1 bind:this={titleEl} bind:this={titleEl}
class={classes} aria-label={label} class={classes} aria-label={label}
style="--parallax-x: {parallax}%;" style="--parallax-x: {parallax}%;"
use:reveal={revealOptions} use:reveal={revealOptions}
> >
<slot /> <slot />
</h1> </svelte:element>
{:else if tag === 'h2'}
<h2 bind:this={titleEl}
class={classes} aria-label={label}
style="--parallax-x: {parallax}%;"
use:reveal={revealOptions}
>
<slot />
</h2>
{:else if tag === 'p'}
<p bind:this={titleEl}
class={classes} aria-label={label}
style="--parallax-x: {parallax}%;"
use:reveal={revealOptions}
>
<slot />
</p>
{/if}