mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 22:30:41 +08:00
Simplify TextInput
Extracts the validation message out of the `TextInput` component. For a nice and flexible layout we should render the validation message outside of the `TextInput` component and just do text input.
This commit is contained in:
@@ -79,6 +79,14 @@
|
||||
width: 100%;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
.validation-message {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
color: var(--color-foreground-red);
|
||||
position: relative;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div>
|
||||
@@ -108,7 +116,6 @@
|
||||
<div style="width:100%; display: flex; align-items: center;">
|
||||
<TextInput
|
||||
{valid}
|
||||
{validationMessage}
|
||||
autofocus
|
||||
disabled={submitInProgress}
|
||||
bind:value={inputValue}
|
||||
@@ -126,6 +133,11 @@
|
||||
<IconSmall name="checkmark" />
|
||||
</IconButton>
|
||||
</div>
|
||||
{#if !valid && validationMessage}
|
||||
<div class="validation-message">
|
||||
<IconSmall name="exclamation-circle" />{validationMessage}
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<Badge
|
||||
variant="outline"
|
||||
|
||||
@@ -68,6 +68,14 @@
|
||||
flex-direction: row;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.validation-message {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
color: var(--color-foreground-red);
|
||||
position: relative;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div>
|
||||
@@ -93,9 +101,7 @@
|
||||
<TextInput
|
||||
autofocus
|
||||
{valid}
|
||||
{validationMessage}
|
||||
disabled={submitInProgress}
|
||||
size="small"
|
||||
placeholder="Add label"
|
||||
bind:value={inputValue}
|
||||
on:submit={addLabel} />
|
||||
@@ -111,6 +117,11 @@
|
||||
<IconSmall name="checkmark" />
|
||||
</IconButton>
|
||||
</div>
|
||||
{#if !valid && validationMessage}
|
||||
<div class="validation-message">
|
||||
<IconSmall name="exclamation-circle" />{validationMessage}
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
<Badge
|
||||
variant="outline"
|
||||
|
||||
Reference in New Issue
Block a user