Use svelte:element to avoid tag conditions
This commit is contained in:
@@ -56,28 +56,11 @@
|
||||
bind:innerWidth bind:innerHeight
|
||||
/>
|
||||
|
||||
{#if tag === 'h1'}
|
||||
<h1 bind:this={titleEl}
|
||||
class={classes} aria-label={label}
|
||||
style="--parallax-x: {parallax}%;"
|
||||
use:reveal={revealOptions}
|
||||
>
|
||||
<slot />
|
||||
</h1>
|
||||
{: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}
|
||||
<svelte:element this={tag}
|
||||
bind:this={titleEl}
|
||||
class={classes} aria-label={label}
|
||||
style="--parallax-x: {parallax}%;"
|
||||
use:reveal={revealOptions}
|
||||
>
|
||||
<slot />
|
||||
</svelte:element>
|
||||
Reference in New Issue
Block a user