import * as React from "react" ; import { TextInput } from "./Input" ; import { EthAddress } from "@joincivil/typescript-types" ; import { isWellFormattedAddress } from "@joincivil/utils" ; export interface AddressInputProps { address : EthAddress ; onChange ( name , value ) : void ; } export class AddressInput extends React . Component < AddressInputProps > { public invalid ( ) { return ! ! this . props . address && ! isWellFormattedAddress ( this . props . address ) ; } public render ( ) { const invalid = this . invalid ( ) ; return ( < TextInput label = "Wallet Address" placeholder = "Enter Wallet Address" name = "EditorWalletInput" onChange = { this . props . onChange } value = { this . props . address } invalid = { invalid } invalidMessage = { "The address you have entered is invalid" } / > ) ; } }