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'; |
||||
|
||||
export function Sidebar(props) { |
||||
return ( |
||||
<div className={props.title!==null ? 'sidebar-on' : ''}> |
||||
<div className="sidebar-shadow" onClick={props.do_close} /> |
||||
<div className="sidebar"> |
||||
{props.content} |
||||
</div> |
||||
<div className="sidebar-title"> |
||||
<a onClick={props.do_close}> <span className="icon icon-back" /> </a> |
||||
{props.title} |
||||
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 ( |
||||
<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> |
||||
</div> |
||||
); |
||||
); |
||||
} |
||||
} |
Loading…
Reference in new issue