2018-03-31 20:36:36 +13:00
|
|
|
|
2018-10-24 21:15:57 +13:00
|
|
|
import React from 'react';
|
|
|
|
|
import { Link } from 'react-router';
|
2018-03-31 20:36:36 +13:00
|
|
|
|
2018-10-24 21:15:57 +13:00
|
|
|
export default class extends React.Component{
|
2018-03-31 20:36:36 +13:00
|
|
|
|
|
|
|
|
constructor(props){
|
|
|
|
|
super(props);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleClick(e){
|
|
|
|
|
if (!this.props.retainScroll){
|
2018-10-24 21:15:57 +13:00
|
|
|
document.getElementById('main').scrollTo(0, 0);
|
2018-03-31 20:36:36 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-24 21:15:57 +13:00
|
|
|
render(){
|
2018-03-31 20:36:36 +13:00
|
|
|
return (
|
|
|
|
|
<Link
|
|
|
|
|
onClick={e => this.handleClick(e)}
|
|
|
|
|
className={this.props.className ? this.props.className : null}
|
2018-10-24 21:15:57 +13:00
|
|
|
to={this.props.to}>
|
2018-03-31 20:36:36 +13:00
|
|
|
{this.props.children}
|
|
|
|
|
</Link>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|