react-icons/md#MdOpenInNew TypeScript Examples

The following examples show how to use react-icons/md#MdOpenInNew. 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: ListBox.tsx    From frontend with Apache License 2.0 5 votes vote down vote up
ListBox: FunctionComponent<Props> = ({ appId, items }) => {
  const { trackEvent } = useMatomo()
  const { t } = useTranslation()

  return (
    <div className={styles.list}>
      {items &&
        items
          .filter((a) => a)
          .map((item, index) => {
            const linkClicked = () => {
              trackEvent({
                category: 'App',
                action:
                  item.content.type === 'url' ? item.content.trackAsEvent : '',
                name: appId ?? 'unknown',
              })
            }
            return (
              <div
                className={`${styles.item} ${item.content.type === 'text' ? styles.noLink : ''
                  }`}
                key={index}
              >
                <div className={styles.icon}>{item.icon}</div>
                <div className={styles.details}>
                  {item.header}
                  {item.content.type === 'text' && (
                    <span className={styles.content}>{item.content.text}</span>
                  )}
                  {item.content.type === 'url' && (
                    <a
                      href={item.content.text}
                      target='_blank'
                      rel='noreferrer'
                      onClick={linkClicked}
                    >
                      {item.content.text}
                    </a>
                  )}
                </div>
                {item.content.type === 'url' && (
                  <div className={styles.externalLink}>
                    <a
                      href={item.content.text}
                      target='_blank'
                      rel='noreferrer'
                      onClick={linkClicked}
                      title={t('open-in-new-tab')}
                    >
                      <MdOpenInNew />
                    </a>
                  </div>
                )}
              </div>
            )
          })}
    </div>
  )
}