mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
Close clone popover when Clipboard icon clicked
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
+11
-3
@@ -1,6 +1,14 @@
|
||||
<script lang="ts">
|
||||
import Icon from '@app/Icon.svelte';
|
||||
import { toClipboard } from '@app/utils';
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
const copy = () => {
|
||||
toClipboard(text);
|
||||
dispatch("copied");
|
||||
};
|
||||
|
||||
export let text: string;
|
||||
export let small = false;
|
||||
@@ -8,8 +16,8 @@
|
||||
|
||||
<style>
|
||||
.clipboard {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
@@ -30,7 +38,7 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<span class="clipboard" class:small on:click|stopPropagation={() => toClipboard(text)}>
|
||||
<span class="clipboard" class:small on:click|stopPropagation={copy}>
|
||||
{#if small}
|
||||
<Icon name="clipboard-small" width={12} height={12} />
|
||||
{:else}
|
||||
|
||||
+3
-1
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Clipboard from '@app/Clipboard.svelte';
|
||||
import { closeFocused } from '@app/Floating.svelte';
|
||||
|
||||
export let name: string;
|
||||
export let value: string;
|
||||
@@ -10,6 +11,7 @@
|
||||
<style>
|
||||
main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.clipboard {
|
||||
visibility: hidden;
|
||||
@@ -39,7 +41,7 @@
|
||||
<input class={$$props.class} readonly={clipboard} {name} {value} />
|
||||
{#if clipboard}
|
||||
<span class="clipboard {$$props.class}">
|
||||
<Clipboard text={value} {small} />
|
||||
<Clipboard text={value} {small} on:copied={closeFocused} />
|
||||
</span>
|
||||
{/if}
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user