mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 10:10:30 +08:00
Extract <TextInput /> component
Signed-off-by: Rūdolfs Ošiņš <rudolfs@osins.org>
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
calculateTimeLock,
|
||||
} from "./lib";
|
||||
import Button from "@app/Button.svelte";
|
||||
import TextInput from "@app/TextInput.svelte";
|
||||
|
||||
export let config: Config;
|
||||
|
||||
@@ -79,29 +80,18 @@
|
||||
</script>
|
||||
|
||||
<style>
|
||||
div.input-caption {
|
||||
.input-caption {
|
||||
font-size: var(--font-size-medium);
|
||||
text-align: left;
|
||||
margin-left: 1.5rem;
|
||||
padding-left: 1.5rem;
|
||||
color: var(--color-secondary);
|
||||
margin-bottom: 2rem;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
div.input-main {
|
||||
.input-main {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
margin: 1rem 1.5rem 0rem;
|
||||
color: var(--color-secondary);
|
||||
}
|
||||
input[type="text"] {
|
||||
margin: 0;
|
||||
margin-right: 1.5rem;
|
||||
}
|
||||
.name {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin: 1rem;
|
||||
margin-bottom: 0;
|
||||
flex-direction: column;
|
||||
}
|
||||
.error {
|
||||
padding-left: 1rem;
|
||||
@@ -114,6 +104,10 @@
|
||||
.description.invalid {
|
||||
color: var(--color-negative) !important;
|
||||
}
|
||||
.name {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<svelte:head>
|
||||
@@ -144,11 +138,12 @@
|
||||
</div>
|
||||
<div class="input-main">
|
||||
<div class="name">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Set amount to withdraw"
|
||||
bind:value={amount}
|
||||
on:input={() => (error = "")} />
|
||||
<div style="width: 14.5rem;">
|
||||
<TextInput
|
||||
placeholder="Set amount to withdraw"
|
||||
bind:value={amount}
|
||||
on:input={() => (error = "")} />
|
||||
</div>
|
||||
<Button variant="primary" on:click={withdraw}>Withdraw</Button>
|
||||
</div>
|
||||
{#if error}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { navigate } from "svelte-routing";
|
||||
import type { Config } from "@app/config";
|
||||
|
||||
import DomainInput from "@app/ens/DomainInput.svelte";
|
||||
import TextInput from "@app/TextInput.svelte";
|
||||
import Button from "@app/Button.svelte";
|
||||
|
||||
export let config: Config;
|
||||
@@ -50,6 +50,7 @@
|
||||
}
|
||||
.name {
|
||||
margin: 1rem;
|
||||
width: 22rem;
|
||||
}
|
||||
.input-info {
|
||||
position: absolute;
|
||||
@@ -82,11 +83,11 @@
|
||||
</div>
|
||||
<div class="input-main">
|
||||
<span class="name">
|
||||
<DomainInput
|
||||
bind:value={input}
|
||||
autofocus
|
||||
placeholder=""
|
||||
root={config.registrar.domain} />
|
||||
<TextInput bind:value={input} autofocus>
|
||||
<svelte:fragment slot="right">
|
||||
.{config.registrar.domain}
|
||||
</svelte:fragment>
|
||||
</TextInput>
|
||||
{#if errors}
|
||||
<div class="input-info">
|
||||
{#each errors as error}
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
: "The reverse record for this address is **not set**. " +
|
||||
"For this name to be correctly associated with the address, " +
|
||||
"a reverse record should be set."),
|
||||
value: r.profile.address,
|
||||
value: r.profile.address ?? "",
|
||||
editable: true,
|
||||
},
|
||||
{
|
||||
@@ -89,7 +89,7 @@
|
||||
validate: "URL",
|
||||
placeholder: "https://acme.org",
|
||||
description: "A homepage or other URL associated with this name.",
|
||||
value: r.profile.url,
|
||||
value: r.profile.url ?? "",
|
||||
editable: true,
|
||||
},
|
||||
{
|
||||
@@ -97,7 +97,7 @@
|
||||
validate: "URL",
|
||||
placeholder: "https://acme.org/avatar.png",
|
||||
description: "An avatar or square image associated with this name.",
|
||||
value: r.profile.avatar,
|
||||
value: r.profile.avatar ?? "",
|
||||
editable: true,
|
||||
},
|
||||
{
|
||||
@@ -105,7 +105,7 @@
|
||||
validate: "handle",
|
||||
placeholder: "Twitter username, eg. 'acme'",
|
||||
description: "The Twitter handle associated with this name.",
|
||||
value: r.profile.twitter,
|
||||
value: r.profile.twitter ?? "",
|
||||
editable: true,
|
||||
},
|
||||
{
|
||||
@@ -114,7 +114,7 @@
|
||||
label: "GitHub",
|
||||
placeholder: "GitHub username, eg. 'acme'",
|
||||
description: "The GitHub username associated with this name.",
|
||||
value: r.profile.github,
|
||||
value: r.profile.github ?? "",
|
||||
editable: true,
|
||||
},
|
||||
{
|
||||
@@ -123,7 +123,7 @@
|
||||
validate: "identity",
|
||||
placeholder: "Radicle URN, eg. rad:git:hnrkqdpm9ub19oc8d…",
|
||||
description: "The local radicle identity associated with this name.",
|
||||
value: r.profile.id,
|
||||
value: r.profile.id ?? "",
|
||||
editable: true,
|
||||
},
|
||||
{
|
||||
@@ -136,7 +136,7 @@
|
||||
"The seed host address. " +
|
||||
"Only domain names with TLS are supported. " +
|
||||
`HTTP(S) API requests use port ${config.seed.api.port}.`,
|
||||
value: r.profile.seed?.host,
|
||||
value: r.profile.seed?.host ?? "",
|
||||
editable: true,
|
||||
},
|
||||
{
|
||||
@@ -146,7 +146,7 @@
|
||||
placeholder: "hynkyndc6w3p8urucakobzncqny7xxtw88…",
|
||||
description:
|
||||
"The Device ID of a Radicle Link node that hosts entities associated with this name.",
|
||||
value: r.profile.seed?.id,
|
||||
value: r.profile.seed?.id ?? "",
|
||||
editable: true,
|
||||
},
|
||||
{
|
||||
@@ -157,7 +157,7 @@
|
||||
description:
|
||||
"URN under which associated project anchors can be found. " +
|
||||
"To point to a Radicle org on Ethereum, use the CAIP-10 ID, eg. *eip155:1:0x4a9cf21…*",
|
||||
value: r.profile.anchorsAccount,
|
||||
value: r.profile.anchorsAccount ?? "",
|
||||
editable: true,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { State, state } from "./state";
|
||||
import { getInfo, withdrawVested } from "./vesting";
|
||||
import type { VestingInfo } from "./vesting";
|
||||
@@ -9,12 +8,7 @@
|
||||
import Address from "@app/Address.svelte";
|
||||
import { formatAddress, isAddressEqual } from "@app/utils";
|
||||
import Button from "@app/Button.svelte";
|
||||
|
||||
let input: HTMLElement;
|
||||
|
||||
onMount(() => {
|
||||
input.focus();
|
||||
});
|
||||
import TextInput from "@app/TextInput.svelte";
|
||||
|
||||
export let config: Config;
|
||||
export let session: Session | null;
|
||||
@@ -38,20 +32,21 @@
|
||||
</script>
|
||||
|
||||
<style>
|
||||
div.input-caption {
|
||||
.input-caption {
|
||||
font-size: var(--font-size-medium);
|
||||
text-align: left;
|
||||
margin-left: 1.5rem;
|
||||
padding-left: 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
margin-bottom: 2rem;
|
||||
color: var(--color-secondary);
|
||||
}
|
||||
div.input-main {
|
||||
.input-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: row;
|
||||
margin-left: 1.5rem;
|
||||
color: var(--color-secondary);
|
||||
gap: 1rem;
|
||||
justify-content: center;
|
||||
}
|
||||
table {
|
||||
table-layout: fixed;
|
||||
@@ -142,14 +137,10 @@
|
||||
</div>
|
||||
<div class="input-main">
|
||||
<span class="name">
|
||||
<div>
|
||||
<input
|
||||
size="40"
|
||||
placeholder=""
|
||||
class="subdomain"
|
||||
<div style="width: 25rem;">
|
||||
<TextInput
|
||||
autofocus
|
||||
disabled={$state === State.Loading}
|
||||
type="text"
|
||||
bind:this={input}
|
||||
bind:value={contractAddress} />
|
||||
</div>
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user