Skip to content

Commit f1e13e8

Browse files
committed
Move plus higher and add smooth crossfade for save icon swap
1 parent e91a400 commit f1e13e8

2 files changed

Lines changed: 38 additions & 12 deletions

File tree

src/lib/components/icons/Icon.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@
137137
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
138138
<polyline points="17 8 12 3 7 8"/>
139139
<line x1="12" y1="3" x2="12" y2="15"/>
140-
<line x1="20.5" y1="0" x2="20.5" y2="5"/>
141-
<line x1="18" y1="2.5" x2="23" y2="2.5"/>
140+
<line x1="20.5" y1="-1" x2="20.5" y2="4"/>
141+
<line x1="18" y1="1.5" x2="23" y2="1.5"/>
142142
</svg>
143143
{:else if name === 'play'}
144144
<svg width={size} height={size} viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">

src/routes/+page.svelte

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,23 +1017,35 @@
10171017
use:tooltip={{ text: $currentFileName ? `Save '${$currentFileName}'` : "Save", shortcut: "Ctrl+S" }}
10181018
aria-label="Save"
10191019
>
1020-
{#if saveFlash === 'save'}
1021-
<Icon name="check" size={16} />
1022-
{:else}
1023-
<Icon name="upload" size={16} />
1024-
{/if}
1020+
<span class="icon-crossfade">
1021+
{#if saveFlash === 'save'}
1022+
<span class="icon-crossfade-item" in:fade={{ duration: 200 }} out:fade={{ duration: 200 }}>
1023+
<Icon name="check" size={16} />
1024+
</span>
1025+
{:else}
1026+
<span class="icon-crossfade-item" in:fade={{ duration: 200 }} out:fade={{ duration: 200 }}>
1027+
<Icon name="upload" size={16} />
1028+
</span>
1029+
{/if}
1030+
</span>
10251031
</button>
10261032
<button
10271033
class="toolbar-btn"
10281034
onclick={() => handleSaveAs()}
10291035
use:tooltip={{ text: "Save As", shortcut: "Ctrl+Shift+S" }}
10301036
aria-label="Save As"
10311037
>
1032-
{#if saveFlash === 'save-as'}
1033-
<Icon name="check" size={16} />
1034-
{:else}
1035-
<Icon name="upload-plus" size={16} />
1036-
{/if}
1038+
<span class="icon-crossfade">
1039+
{#if saveFlash === 'save-as'}
1040+
<span class="icon-crossfade-item" in:fade={{ duration: 200 }} out:fade={{ duration: 200 }}>
1041+
<Icon name="check" size={16} />
1042+
</span>
1043+
{:else}
1044+
<span class="icon-crossfade-item" in:fade={{ duration: 200 }} out:fade={{ duration: 200 }}>
1045+
<Icon name="upload-plus" size={16} />
1046+
</span>
1047+
{/if}
1048+
</span>
10371049
</button>
10381050
<button class="toolbar-btn" onclick={() => exportDialogOpen = true} use:tooltip={{ text: "Python Code", shortcut: "Ctrl+E" }} aria-label="View Python Code">
10391051
<Icon name="braces" size={16} />
@@ -1416,6 +1428,20 @@
14161428
background: color-mix(in srgb, var(--error) 15%, var(--surface-raised));
14171429
}
14181430
1431+
.icon-crossfade {
1432+
position: relative;
1433+
display: flex;
1434+
align-items: center;
1435+
justify-content: center;
1436+
width: 16px;
1437+
height: 16px;
1438+
}
1439+
1440+
.icon-crossfade-item {
1441+
position: absolute;
1442+
display: flex;
1443+
}
1444+
14191445
/* Logo overlay */
14201446
.logo-overlay {
14211447
position: fixed;

0 commit comments

Comments
 (0)