import { checkIsEmoji } from 'src/utils/emoji';
import { trimString } from '../../utils/utils';
import styles from './ValueImg.module.scss';

const hydrogen = require('../../image/hydrogen.svg');
const tocyb = require('../../image/boot.png');
const boot = require('../../image/large-green.png');
const downOutline = require('../../image/chevronDownOutline.svg');
const gol = require('../../image/seedling.png');
const atom = require('../../image/cosmos-2.svg');
const eth = require('../../image/Ethereum_logo_2014.svg');
const pool = require('../../image/gravitydexPool.png');
const ibc = require('../../image/ibc-unauth.png');
const cosmos = require('../../image/cosmos-2.svg');
const osmosis = require('../../image/osmosis.svg');
const customNetwork = require('../../image/large-orange-circle.png');

const pussy = '๐ŸŸฃ';

function ValueImg({
  text,
  onlyImg,
  marginImg,
  marginContainer,
  justifyContent,
  zIndexImg,
  flexDirection,
  size,
  type,
  ...props
}) {
  let img = null;
  let textCurency = text;

  switch (text) {
    case 'millivolt':
      img = 'โšก๏ธ';
      textCurency = 'V';
      break;

    case 'milliampere':
      img = '๐Ÿ’ก';
      textCurency = 'A';
      break;

    case 'hydrogen':
      img = hydrogen;
      textCurency = 'H';
      break;

    case 'liquidpussy':
      img = hydrogen;
      textCurency = 'LP';
      break;

    case 'boot':
      img = boot;
      textCurency = 'BOOT';
      break;

    case 'tocyb':
      img = tocyb;
      textCurency = 'TOCYB';
      break;

    case 'choose':
      img = downOutline;
      textCurency = 'choose';
      break;

    case 'GOL':
      img = gol;
      textCurency = 'GOL';
      break;

    case 'ATOM':
    case 'atom':
      img = atom;
      textCurency = 'ATOM';
      break;

    case 'eth':
      img = eth;
      textCurency = 'ETH';
      break;

    case 'cosmos':
      img = cosmos;
      textCurency = 'cosmos';
      break;

    case 'bostrom':
      img = boot;
      textCurency = 'bostrom';
      break;

    case 'osmo':
    case 'OSMO':
      img = osmosis;
      textCurency = 'OSMO';
      break;

    case 'osmosis':
      img = osmosis;
      textCurency = 'osmosis';
      break;

    case 'pussy':
    case 'PUSSY':
      img = pussy;
      textCurency = 'PUSSY';
      break;

    case 'space-pussy':
      img = pussy;
      textCurency = 'space-pussy';
      break;

    default:
      if (text.includes('pool')) {
        textCurency = trimString(text, 3, 3);
        img = pool;
        break;
      } else if (text.includes('ibc')) {
        textCurency = trimString(text, 3, 3);
        img = ibc;
        break;
      } else if (text.length > 32) {
        textCurency = text.slice(0, 32);
        img = customNetwork;
        break;
      } else {
        textCurency = text;
        img = customNetwork;
        break;
      }
  }

  if (type && type === 'pool') {
    img = pool;
  }
  if (type && type === 'ibc') {
    img = ibc;
  }

  const emojiIcon = checkIsEmoji(img);

  return (
    <div
      style={{
        display: 'inline-flex',
        alignItems: 'center',
        justifyContent: justifyContent || 'flex-start',
        margin: marginContainer || 0,
        flexDirection: flexDirection || 'unset',
      }}
      {...props}
    >
      {!onlyImg && (
        <>
          <span
            style={{
              textOverflow: 'ellipsis',
              whiteSpace: 'nowrap',
              overflow: 'hidden',
              textTransform: 'uppercase',
            }}
          >
            {textCurency}
          </span>
          &nbsp;
          {img &&
            (emojiIcon ? (
              <span className={styles.emojiIcon}>{img}</span>
            ) : (
              <img
                style={{
                  margin: marginImg || 0,
                  width: size || 20,
                  height: size || 20,
                  // objectFit: 'cover',
                  zIndex: zIndexImg || 0,
                }}
                src={img}
                alt="text"
              />
            ))}
        </>
      )}
    </div>
  );
}

export default ValueImg;

Synonyms

pussy-ts/src/containers/wasm/index.jsx
pussy-ts/src/containers/trollBox/index.jsx
cyb/src/containers/movie/index.jsx
cyb/src/components/battery/index.jsx
cyb/src/components/vitalik/index.jsx
pussy-ts/src/containers/oracle/index.jsx
cyb/src/containers/wasm/index.jsx
cyb/src/components/ButtonNetwork/index.jsx
pussy-ts/src/containers/blok/index.jsx
pussy-ts/src/components/battery/index.jsx
cyb/src/components/searchSnippet/index.jsx
pussy-ts/src/containers/validator/index.jsx
pussy-ts/src/containers/Objects/index.jsx
cyb/src/containers/parameters/index.jsx
pussy-ts/src/containers/parameters/index.jsx
pussy-ts/src/containers/market/index.jsx
cyb/src/containers/oracle/index.jsx
cyb/src/components/particle/index.jsx
pussy-ts/src/components/numberCurrency/index.jsx
cyb/src/components/numberCurrency/index.jsx
pussy-ts/src/containers/testKeplre/index.jsx
pussy-ts/src/components/valueImg/index.jsx
pussy-ts/src/components/ButtonNetwork/index.jsx
pussy-ts/src/containers/network/index.jsx
pussy-ts/src/components/particle/index.jsx
pussy-ts/src/containers/movie/index.jsx
cyb/src/containers/market/index.jsx
pussy-ts/src/containers/help/index.jsx
pussy-ts/src/components/statusTooltip/index.jsx
cyb/src/containers/help/index.jsx
pussy-ts/src/components/vitalik/index.jsx
cyb/src/containers/testPage/index.jsx
pussy-ts/src/components/searchSnippet/index.jsx
cyb/src/components/statusTooltip/index.jsx
cyb/src/containers/trollBox/index.jsx
pussy-ts/src/containers/Validators/components/index.jsx
pussy-ts/src/containers/portal/stateComponent/index.jsx
pussy-ts/src/containers/parameters/tabs/index.jsx
pussy-ts/src/containers/wasm/codes/index.jsx
pussy-ts/src/containers/wasm/contract/index.jsx
cyb/src/containers/wasm/contract/index.jsx
cyb/src/containers/portal/stateComponent/index.jsx
cyb/src/containers/parameters/tabs/index.jsx
cyb/src/containers/temple/components/canvasOne/index.jsx
cyb/src/containers/wasm/contract/renderAbi/index.jsx
cyb/src/containers/wasm/codes/code/index.jsx
pussy-ts/src/containers/portal/components/progressCard/index.jsx
pussy-ts/src/containers/temple/components/canvasOne/index.jsx
pussy-ts/src/containers/portal/components/ActionBar/index.jsx
cyb/src/containers/wasm/codes/codePage/index.jsx
pussy-ts/src/containers/portal/components/nextUnfreeze/index.jsx
pussy-ts/src/containers/portal/components/Released/index.jsx
cyb/src/containers/portal/components/progressCard/index.jsx
cyb/src/containers/portal/components/currentGift/index.jsx
pussy-ts/src/containers/wasm/codes/code/index.jsx
pussy-ts/src/containers/wasm/contract/renderAbi/index.jsx
pussy-ts/src/containers/portal/components/currentGift/index.jsx
cyb/src/containers/portal/components/Released/index.jsx
cyb/src/containers/portal/components/imgNetwork/index.jsx
pussy-ts/src/containers/portal/components/imgNetwork/index.jsx
pussy-ts/src/containers/energy/ui/card/index.jsx
pussy-ts/src/containers/wasm/codes/codePage/index.jsx
cyb/src/containers/portal/components/nextUnfreeze/index.jsx
cyb/src/containers/energy/ui/card/index.jsx
pussy-ts/src/containers/sigma/components/cardUi/ChartTotal/index.jsx
pussy-ts/src/containers/sigma/components/cardUi/DetailsBalance/index.jsx
pussy-ts/src/containers/sigma/components/cardUi/BtnArrow/index.jsx
cyb/src/containers/sigma/components/cardUi/ChartTotal/index.jsx
cyb/src/containers/sigma/components/cardUi/BtnArrow/index.jsx
cyb/src/containers/sigma/components/cardUi/DetailsBalance/index.jsx

Neighbours