svelte icon indicating copy to clipboard operation
svelte copied to clipboard

Parameter to control the state of transitions without necessarily using If.

Open caesar-exploit opened this issue 2 years ago • 2 comments

Describe the problem

Sometimes it is not necessary to place an If to control transitions, in specific cases the layout may break.

Describe the proposed solution

<div transition:fade={{ show: true }}>

Alternatives considered

Set a parameter to control the state of the transition.

Importance

nice to have

caesar-exploit avatar Jul 11 '22 02:07 caesar-exploit

Without an example of cases where the layout breaks, it's hard to know whether this is truly needed. I assume you've already encountered one such case. In that case, would {#key} (https://svelte.dev/docs#template-syntax-key) have worked for you in place of {#if}?

rmunn avatar Jul 11 '22 05:07 rmunn

I tried, specifically I'm using Fly for scrolling, but as such #key just updates it.

I'm reevaluating my comments, because the layout as such doesn't break, it would break if the Handle Button was visible in the mobile version.

But now that we are here I still consider that it would be nice to control the state of the transitions with a parameter, or something that solves repeating code that many have chosen to do this.

`{#if some}

{/else}
{/if}`

caesar-exploit avatar Jul 11 '22 13:07 caesar-exploit