Changed Card link to Link

This commit is contained in:
Camerin 2022-01-12 14:45:30 -05:00
parent 6ebb372097
commit 6c8e95e6ab
1 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import React from 'react';
import { Link } from 'react-router-dom';
import '../css/Card.css';
const Card = (props) => {
@ -12,11 +13,16 @@ const Card = (props) => {
* children - jsx that will be displayed in the content of the card
*
*/
let scrollToTop = () => {
window.scrollTo(0,0);
};
return (
<div className="card">
<div>
{props.link ?
<a href={props.link} className="title">{props.title}</a>
<Link to={props.link} className="title" onClick={()=>scrollToTop()}>{props.title}</Link>
:<div className="title">{props.title}</div>
}
<div className="content-box">