Add clipboard button to clone input

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2022-02-25 10:56:07 +01:00
parent 69b45e1cf0
commit 000e15c48a
3 changed files with 55 additions and 16 deletions
+6
View File
@@ -31,6 +31,7 @@
--color-light: #add0e4;
--color-yellow: #ffff99;
--color-yellow-background: #ffff9911;
--color-yellow-background-solid: #222929;
--color-yellow-background-lighter: #ffff9922;
--color-positive: #53db53;
--color-positive-background: #53db5311;
@@ -352,6 +353,11 @@ label.input {
background: var(--color-yellow-background);
}
.yellow {
color: var(--color-yellow);
background: var(--color-yellow-background-solid);
}
.off-centered {
height: 100%;
padding-top: 5rem;
+45
View File
@@ -0,0 +1,45 @@
<script lang="ts">
import Clipboard from '@app/Clipboard.svelte';
export let name: string;
export let value: string;
export let small = false;
export let clipboard = false;
</script>
<style>
main {
display: flex;
}
.clipboard {
visibility: hidden;
margin-left: -4rem;
width: 4rem;
text-align: right;
-webkit-mask: linear-gradient(90deg, transparent 0%, #fff 50%);
mask: linear-gradient(90deg, transparent 0%, #fff 50%);
border-radius: 0 0.25rem 0.25rem 0;
}
input {
font-size: 0.75rem;
font-family: var(--font-family-monospace);
padding: 0.5rem;
border: none;
outline: none;
width: 24rem;
text-overflow: ellipsis !important;
border-radius: 0.25rem;
}
main:hover .clipboard {
visibility: visible;
}
</style>
<main>
<input class={$$props.class} readonly={clipboard} {name} {value} />
{#if clipboard}
<span class="clipboard {$$props.class}">
<Clipboard text={value} {small} />
</span>
{/if}
</main>
+4 -16
View File
@@ -5,6 +5,7 @@
import { Browser, ProjectContent, Project } from '@app/project';
import AnchorBadge from '@app/base/profiles/AnchorBadge.svelte';
import type { Tree } from "@app/project";
import Input from "@app/Input.svelte";
import BranchSelector from './BranchSelector.svelte';
import PeerSelector from './PeerSelector.svelte';
@@ -102,20 +103,6 @@
.clone-dropdown.clone-dropdown-visible {
display: block;
}
.clone-dropdown input {
color: var(--color-yellow);
background: var(--color-yellow-background);
}
.dropdown input {
font-size: 0.75rem;
font-family: var(--font-family-monospace);
padding: 0.5rem;
border: none;
outline: none;
width: 24rem;
text-overflow: ellipsis !important;
border-radius: 0.25rem;
}
.dropdown label {
display: block;
color: var(--color-foreground-faded);
@@ -172,10 +159,11 @@
class="dropdown clone-dropdown"
class:clone-dropdown-visible={dropdownState.clone}
>
<input
readonly
<Input
name="clone-url"
value="https://{seed.git.host}/{utils.parseRadicleId(urn)}.git"
class="yellow"
clipboard
/>
<label for="clone-url"
>Use Git to clone this repository from the URL above.</label