forked from newthuhole/hole_thu_frontend
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
966 B
30 lines
966 B
import React, {Component, PureComponent} from 'react'; |
|
import './Sidebar.css'; |
|
|
|
export class Sidebar extends PureComponent { |
|
constructor(props) { |
|
super(props); |
|
this.sidebar_ref=React.createRef(); |
|
} |
|
|
|
componentWillReceiveProps(nextProps) { |
|
//console.log('sidebar top'); |
|
if(this.sidebar_ref.current) |
|
this.sidebar_ref.current.scrollTop=0; |
|
} |
|
|
|
render() { |
|
return ( |
|
<div className={this.props.title!==null ? 'sidebar-on' : ''}> |
|
<div className="sidebar-shadow" onClick={this.props.do_close} /> |
|
<div ref={this.sidebar_ref} className="sidebar"> |
|
{this.props.content} |
|
</div> |
|
<div className="sidebar-title"> |
|
<a onClick={this.props.do_close}> <span className="icon icon-back" /> </a> |
|
{this.props.title} |
|
</div> |
|
</div> |
|
); |
|
} |
|
} |