/**
 * Copyright 2024 Phenix Real Time Solutions, Inc. Confidential and Proprietary. All Rights Reserved.
 */
import React from 'react';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {IconDefinition} from '@fortawesome/fontawesome-svg-core';

interface ILink {
  icon?: IconDefinition;
  text?: string;
  iconColor?: string;
  link: string;
}

export const NewTabLink = (props: ILink & Partial<HTMLLinkElement>): React.JSX.Element => {
  const {icon, className, text, link, iconColor = 'white'} = props;

  return (
    <a rel="noopener noreferrer" target="_blank" href={link} className={className}>
      {icon && <FontAwesomeIcon icon={icon} style={{color: iconColor}} />}
      {text}
    </a>
  );
};

export default NewTabLink;
