-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Share pal * extract serializer, do some perf stuff
- Loading branch information
1 parent
60df5ff
commit 47915fa
Showing
8 changed files
with
164 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<script lang="ts"> | ||
import ExportIcon from "virtual:icons/fa6-solid/file-export"; | ||
import Tooltip from "./Tooltip.svelte"; | ||
import { buttonStyle } from "../lib/styles"; | ||
import { serializePaletteForUrl } from "../lib/utils"; | ||
import colorStore from "../stores/color-store"; | ||
$: palette = $colorStore.palettes[$colorStore.currentPal]; | ||
let copyState = "idle" as "idle" | "copied"; | ||
</script> | ||
|
||
<div class="mt-0.5 ml-2"> | ||
<Tooltip> | ||
<div slot="content" let:open class="max-w-md overflow-hidden"> | ||
<div class="font-bold">Share via url</div> | ||
<div class="font-mono text-sm p-1 border"> | ||
{open && serializePaletteForUrl(palette)} | ||
</div> | ||
<div class="flex items-center"> | ||
<button | ||
class={buttonStyle} | ||
on:click={() => { | ||
navigator.clipboard.writeText(serializePaletteForUrl(palette)); | ||
copyState = "copied"; | ||
setTimeout(() => { | ||
copyState = "idle"; | ||
}, 2000); | ||
}} | ||
> | ||
Copy | ||
</button> | ||
{#if copyState === "copied"} | ||
<div class=" ml-4">Copied!</div> | ||
{/if} | ||
</div> | ||
</div> | ||
|
||
<button slot="target" let:toggle on:click={toggle} class={buttonStyle}> | ||
<ExportIcon class="text-xl" /> | ||
</button> | ||
</Tooltip> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters