Skip to content

Commit

Permalink
chore: merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Oct 28, 2024
2 parents 89c3d88 + 2f93aac commit d3393e6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/frontend/src/lib/components/send/SendInputAmount.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script lang="ts">
import { Input } from '@dfinity/gix-components';
import { debounce, isNullish, nonNullish } from '@dfinity/utils';
import type { BigNumber } from '@ethersproject/bignumber';
import { createEventDispatcher } from 'svelte';
import { slide } from 'svelte/transition';
import MaxButton from '$lib/components/common/MaxButton.svelte';
import InputCurrency from '$lib/components/ui/InputCurrency.svelte';
import { SLIDE_DURATION } from '$lib/constants/transition.constants';
import { i18n } from '$lib/stores/i18n.store';
import { invalidAmount } from '$lib/utils/input.utils';
Expand Down Expand Up @@ -56,19 +56,16 @@
</script>

<label for="amount" class="px-4.5 font-bold">{$i18n.core.text.amount}</label>
<Input
<InputCurrency
name="amount"
inputType="currency"
required
bind:value={amount}
decimals={tokenDecimals}
{placeholder}
spellcheck={false}
testId="amount-input"
on:nnsInput={onInput}
>
<MaxButton slot="inner-end" on:click={onMax} disabled={isNullish(calculateMax)} />
</Input>
</InputCurrency>

{#if nonNullish(error)}
<p transition:slide={SLIDE_DURATION} class="pb-3 text-cyclamen">{error.message}</p>
Expand Down
24 changes: 24 additions & 0 deletions src/frontend/src/lib/components/ui/InputCurrency.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<script lang="ts">
import { Input } from '@dfinity/gix-components';
export let value: number | undefined = undefined;
export let name: string;
export let placeholder: string;
export let required = true;
export let decimals: number | undefined = undefined;
export let testId: string | undefined = undefined;
</script>

<Input
{name}
inputType="currency"
{required}
bind:value
{decimals}
{placeholder}
spellcheck={false}
{testId}
on:nnsInput
>
<slot name="inner-end" slot="inner-end" />
</Input>

0 comments on commit d3393e6

Please sign in to comment.