Use svelte:element to avoid tag conditions
This commit is contained in:
@@ -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}
|
|
||||||
Reference in New Issue
Block a user