react-icons#IconBaseProps TypeScript Examples

The following examples show how to use react-icons#IconBaseProps. 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: SocialIcons.tsx    From portfolio with MIT License 5 votes vote down vote up
function resolveIcon(entry: Tuple<string>): React.ReactNode {
  const [type, url] = entry;

  const props: IconBaseProps = {
    className: 'icon cursor-pointer text-2xl mr-6',
    color: Colors[type],
  };

  let icon: Maybe<React.ReactNode> = null;

  switch (type) {
    case ContactType.linkedin:
      icon = <LinkedinIcon {...props} />;
      break;

    case ContactType.twitter:
      icon = <TwitterIcon {...props} />;
      break;

    case ContactType.github:
      icon = <GithubIcon {...props} />;
      break;

    case ContactType.youtube:
      icon = <YoutubeIcon {...props} />;
      break;

    case ContactType.email:
      icon = <MailIcon {...props} />;
      break;

    case ContactType.buymeacoffee:
      icon = <BuymeacoffeeIcon {...props} />;
      break;
    default:
      break;
  }

  return (
    <a
      className='social-icons'
      href={url}
      aria-label={type}
      target='_blank'
      rel='noopener noreferrer'
    >
      {icon}
    </a>
  );
}