Changed Card link to Link
This commit is contained in:
parent
6ebb372097
commit
6c8e95e6ab
|
|
@ -1,4 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
import '../css/Card.css';
|
import '../css/Card.css';
|
||||||
|
|
||||||
const Card = (props) => {
|
const Card = (props) => {
|
||||||
|
|
@ -12,11 +13,16 @@ const Card = (props) => {
|
||||||
* children - jsx that will be displayed in the content of the card
|
* children - jsx that will be displayed in the content of the card
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
let scrollToTop = () => {
|
||||||
|
window.scrollTo(0,0);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card">
|
<div className="card">
|
||||||
<div>
|
<div>
|
||||||
{props.link ?
|
{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="title">{props.title}</div>
|
||||||
}
|
}
|
||||||
<div className="content-box">
|
<div className="content-box">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue