Skip to content

Commit

Permalink
try to fix prefill amount and add to else case (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jxnis authored Sep 4, 2023
1 parent c8f6cf7 commit 6ac984f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ export const MbAmountAccountInput = ({
controlStatus={
isCleared || !amount
? EControlStatus.NORMAL
: isAmountValid
: isAmountValid || amount === '1'
? EControlStatus.VALID
: EControlStatus.INVALID
}
onChange={handleAmountDebounceFor500}
hasPercentageLabel={isPercentage}
disabled={amount === '1'}
defaultValue={amount === '1' ? 1 : undefined}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@ export const MbNearAmountAccount = ({
controlStatus={defaultAmountStatus(amount.value)}
disabled
hasPercentageLabel={isPercentage}
value={amount.value}
value={totalAmount !== 1 ? amount.value : undefined}
defaultValue={totalAmount === 1 ? 1 : undefined}
/>
</div>
<MbInput
Expand Down
2 changes: 1 addition & 1 deletion src/components/inputs/input-field/inputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const MbInput = forwardRef<HTMLInputElement, InputProps>(
ref={ref}
placeholder={placeholder}
type={type}
value={value}
value={!defaultValue ? value : undefined}
maxLength={maxChars}
required={required}
defaultValue={defaultValue}
Expand Down

1 comment on commit 6ac984f

@vercel
Copy link

@vercel vercel bot commented on 6ac984f Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.