Browse Source
- click handler event binding - click handler on img elem - trailing space in content - sidebar will-change optimization - sidebar auto to top - sidebar not closed after post - reply form bottom positiondev

8 changed files with 33 additions and 19 deletions
@ -1,17 +1,29 @@ |
|||||||
import React, {Component} from 'react'; |
import React, {Component, PureComponent} from 'react'; |
||||||
import './Sidebar.css'; |
import './Sidebar.css'; |
||||||
|
|
||||||
export function Sidebar(props) { |
export class Sidebar extends PureComponent { |
||||||
|
constructor(props) { |
||||||
|
super(props); |
||||||
|
this.sidebar_ref=React.createRef(); |
||||||
|
} |
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) { |
||||||
|
//console.log('sidebar top');
|
||||||
|
this.sidebar_ref.current.scrollTo(0,0); |
||||||
|
} |
||||||
|
|
||||||
|
render() { |
||||||
return ( |
return ( |
||||||
<div className={props.title!==null ? 'sidebar-on' : ''}> |
<div className={this.props.title!==null ? 'sidebar-on' : ''}> |
||||||
<div className="sidebar-shadow" onClick={props.do_close} /> |
<div className="sidebar-shadow" onClick={this.props.do_close} /> |
||||||
<div className="sidebar"> |
<div ref={this.sidebar_ref} className="sidebar"> |
||||||
{props.content} |
{this.props.content} |
||||||
</div> |
</div> |
||||||
<div className="sidebar-title"> |
<div className="sidebar-title"> |
||||||
<a onClick={props.do_close}> <span className="icon icon-back" /> </a> |
<a onClick={this.props.do_close}> <span className="icon icon-back" /> </a> |
||||||
{props.title} |
{this.props.title} |
||||||
</div> |
</div> |
||||||
</div> |
</div> |
||||||
); |
); |
||||||
|
} |
||||||
} |
} |
Loading…
Reference in new issue