Add icons to column headers, click them to scroll to top
This commit is contained in:
parent
1f18cf97b5
commit
ac77170d19
@ -5,15 +5,21 @@ import PureRenderMixin from 'react-addons-pure-render-mixin';
|
|||||||
const Column = React.createClass({
|
const Column = React.createClass({
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
type: React.PropTypes.string
|
type: React.PropTypes.string,
|
||||||
|
icon: React.PropTypes.string
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [PureRenderMixin],
|
mixins: [PureRenderMixin],
|
||||||
|
|
||||||
|
handleHeaderClick () {
|
||||||
|
let node = ReactDOM.findDOMNode(this);
|
||||||
|
node.querySelector('.scrollable').scrollTo(0, 0);
|
||||||
|
},
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<div style={{ width: '380px', flex: '0 0 auto', background: '#282c37', margin: '10px', marginRight: '0', display: 'flex', flexDirection: 'column' }}>
|
<div style={{ width: '380px', flex: '0 0 auto', background: '#282c37', margin: '10px', marginRight: '0', display: 'flex', flexDirection: 'column' }}>
|
||||||
<ColumnHeader type={this.props.type} />
|
<ColumnHeader icon={this.props.icon} type={this.props.type} onClick={this.handleHeaderClick} />
|
||||||
<StatusListContainer type={this.props.type} />
|
<StatusListContainer type={this.props.type} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -3,14 +3,27 @@ import PureRenderMixin from 'react-addons-pure-render-mixin';
|
|||||||
const ColumnHeader = React.createClass({
|
const ColumnHeader = React.createClass({
|
||||||
|
|
||||||
propTypes: {
|
propTypes: {
|
||||||
type: React.PropTypes.string
|
icon: React.PropTypes.string,
|
||||||
|
type: React.PropTypes.string,
|
||||||
|
onClick: React.PropTypes.func
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [PureRenderMixin],
|
mixins: [PureRenderMixin],
|
||||||
|
|
||||||
|
handleClick () {
|
||||||
|
this.props.onClick();
|
||||||
|
},
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
let icon = '';
|
||||||
|
|
||||||
|
if (this.props.icon) {
|
||||||
|
icon = <i className={`fa fa-fw fa-${this.props.icon}`} style={{ display: 'inline-block', marginRight: '5px' }} />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ padding: '15px', fontSize: '16px', background: '#2f3441', flex: '0 0 auto' }}>
|
<div onClick={this.handleClick} style={{ padding: '15px', fontSize: '16px', background: '#2f3441', flex: '0 0 auto', cursor: 'pointer' }}>
|
||||||
|
{icon}
|
||||||
{this.props.type}
|
{this.props.type}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -8,8 +8,8 @@ const ColumnsArea = React.createClass({
|
|||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<div style={{ display: 'flex', flexDirection: 'row', flex: '1' }}>
|
<div style={{ display: 'flex', flexDirection: 'row', flex: '1' }}>
|
||||||
<Column type='home' />
|
<Column icon='home' type='home' />
|
||||||
<Column type='mentions' />
|
<Column icon='at' type='mentions' />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ const StatusList = React.createClass({
|
|||||||
|
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<div style={{ overflowY: 'scroll', flex: '1 1 auto' }}>
|
<div style={{ overflowY: 'scroll', flex: '1 1 auto' }} className='scrollable'>
|
||||||
<div>
|
<div>
|
||||||
{this.props.statuses.map((status) => {
|
{this.props.statuses.map((status) => {
|
||||||
return <Status key={status.get('id')} status={status} onReply={this.props.onReply} onReblog={this.props.onReblog} onFavourite={this.props.onFavourite} />;
|
return <Status key={status.get('id')} status={status} onReply={this.props.onReply} onReblog={this.props.onReblog} onFavourite={this.props.onFavourite} />;
|
||||||
|
Loading…
Reference in New Issue
Block a user