-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #440 from lidofinance/develop
Develop to main
- Loading branch information
Showing
62 changed files
with
744 additions
and
546 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
features/rewards/components/address-input/address-input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { FC, useMemo } from 'react'; | ||
import { Input, Loader, Identicon } from '@lidofinance/lido-ui'; | ||
import CopyAddressUrl from 'features/rewards/components/CopyAddressUrl'; | ||
import { isValidAnyAddress } from 'features/rewards/utils'; | ||
import { ReactComponent as ErrorTriangle } from 'assets/icons/error-triangle.svg'; | ||
|
||
import { AddressInputProps } from './types'; | ||
|
||
export const AddressInput: FC<AddressInputProps> = (props) => { | ||
const { | ||
inputValue, | ||
isAddressResolving, | ||
handleInputChange, | ||
address, | ||
addressError: invalidENSAddress, | ||
loading, | ||
} = props; | ||
|
||
const invalidEthereumAddress = useMemo( | ||
() => inputValue.length > 0 && !isValidAnyAddress(inputValue), | ||
[inputValue], | ||
); | ||
|
||
return ( | ||
<Input | ||
fullwidth | ||
value={inputValue} | ||
onChange={(e) => handleInputChange(e.target.value)} | ||
placeholder="Ethereum address" | ||
leftDecorator={ | ||
loading || isAddressResolving ? ( | ||
<Loader size="small" /> | ||
) : invalidEthereumAddress || invalidENSAddress ? ( | ||
<ErrorTriangle /> | ||
) : address ? ( | ||
<Identicon data-testid="addressIcon" address={address} /> | ||
) : null | ||
} | ||
rightDecorator={address ? <CopyAddressUrl address={inputValue} /> : null} | ||
spellCheck="false" | ||
error={ | ||
invalidEthereumAddress | ||
? 'Invalid ethereum address' | ||
: invalidENSAddress | ||
? invalidENSAddress | ||
: null | ||
} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './address-input'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export type AddressInputProps = { | ||
inputValue: string; | ||
isAddressResolving: boolean; | ||
handleInputChange: (value: string) => void; | ||
address: string; | ||
addressError: string; | ||
loading: boolean; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.