Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Close clone popover when Clipboard icon clicked
Sebastian Martinez committed 3 years ago
commit 8021f6396dcb3655989a692a15e2ca8f37985512
parent 8bc659aff28c59088d33cede3e0460eca5e05fc9
2 files changed +14 -4
modified src/Clipboard.svelte
@@ -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}
modified src/Input.svelte
@@ -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>