2021-07-03 00:40:02 +00:00
|
|
|
import React from "react";
|
|
|
|
import Address from "./Address";
|
|
|
|
import AddressLink from "./AddressLink";
|
|
|
|
import ENSName from "./ENSName";
|
|
|
|
import ENSNameLink from "./ENSNameLink";
|
|
|
|
|
|
|
|
type AddressOrENSNameProps = {
|
|
|
|
address: string;
|
|
|
|
ensName?: string;
|
|
|
|
selectedAddress?: string;
|
2021-07-19 03:38:38 +00:00
|
|
|
text?: string;
|
2021-07-03 00:40:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const AddressOrENSName: React.FC<AddressOrENSNameProps> = ({
|
|
|
|
address,
|
|
|
|
ensName,
|
|
|
|
selectedAddress,
|
2021-07-19 03:38:38 +00:00
|
|
|
text,
|
2021-07-05 23:55:07 +00:00
|
|
|
}) => (
|
2021-07-19 03:38:38 +00:00
|
|
|
<>
|
2021-07-05 23:55:07 +00:00
|
|
|
{address === selectedAddress ? (
|
|
|
|
<>
|
|
|
|
{ensName ? (
|
|
|
|
<ENSName name={ensName} address={address} />
|
|
|
|
) : (
|
|
|
|
<Address address={address} />
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
{ensName ? (
|
|
|
|
<ENSNameLink name={ensName} address={address} />
|
|
|
|
) : (
|
2021-07-19 03:38:38 +00:00
|
|
|
<AddressLink address={address} text={text} />
|
2021-07-05 23:55:07 +00:00
|
|
|
)}
|
|
|
|
</>
|
|
|
|
)}
|
2021-07-19 03:38:38 +00:00
|
|
|
</>
|
2021-07-05 23:55:07 +00:00
|
|
|
);
|
2021-07-03 00:40:02 +00:00
|
|
|
|
|
|
|
export default React.memo(AddressOrENSName);
|