bug fixes

- 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 position
This commit is contained in:
xmcp
2019-06-12 16:35:20 +08:00
parent f72ab83ca4
commit ed4794ed5a
8 changed files with 33 additions and 19 deletions

View File

@@ -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}
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}>&nbsp;<span className="icon icon-back" />&nbsp;</a>
{this.props.title}
</div>
</div>
<div className="sidebar-title">
<a onClick={props.do_close}>&nbsp;<span className="icon icon-back" />&nbsp;</a>
{props.title}
</div>
</div>
);
);
}
}