import "./styles.sass";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
import {faCaretRight} from "@fortawesome/free-solid-svg-icons";
import {Link} from "react-router-dom";


const Card = (props) => {
    const content = <div className="card">
        <div className="content">
            <FontAwesomeIcon icon={props.icon} className="icon"/>
            <h2 className="text">{props.text}</h2>
        </div>
        <FontAwesomeIcon icon={faCaretRight} className="icon"/>
    </div>;

    return (
        props.to.startsWith("https") ? <a href={props.to} className="link" target="_blank">{content}</a> : <Link to={props.to} className="link">{content}</Link>
    )
}

export default Card;