components#Logo TypeScript Examples

The following examples show how to use components#Logo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CurrencyLogo.tsx    From interface-v2 with GNU General Public License v3.0 5 votes
CurrencyLogo: React.FC<CurrencyLogoProps> = ({
  currency,
  size = '24px',
  style,
}) => {
  const classes = useStyles();
  const uriLocations = useHttpLocations(
    currency instanceof WrappedTokenInfo ? currency.logoURI : undefined,
  );

  const srcs: string[] = useMemo(() => {
    if (currency === ETHER) return [];

    if (currency instanceof Token) {
      if (currency instanceof WrappedTokenInfo) {
        return [...getTokenLogoURL(currency.address), ...uriLocations];
      }

      return getTokenLogoURL(currency.address);
    }
    return [];
  }, [currency, uriLocations]);

  if (currency === ETHER) {
    return (
      <Box
        style={style}
        width={size}
        height={size}
        borderRadius={size}
        overflow='hidden'
      >
        <img
          className={classes.logoStyled}
          style={{ width: size, height: size }}
          src={EthereumLogo}
          alt='Ethereum Logo'
        />
      </Box>
    );
  }

  return (
    <Box
      width={size}
      height={size}
      borderRadius={size}
      overflow='hidden'
      bgcolor='white'
      display='flex'
      justifyContent='center'
      alignItems='center'
    >
      <Logo
        srcs={srcs}
        size={size}
        alt={`${currency?.symbol ?? 'token'} logo`}
      />
    </Box>
  );
}
Example #2
Source File: ListLogo.tsx    From interface-v2 with GNU General Public License v3.0 5 votes
ListLogo: React.FC<ListLogoProps> = ({ logoURI, size, alt }) => {
  const srcs: string[] = useHttpLocations(logoURI);

  return <Logo size={size} alt={alt} srcs={srcs} />;
}