Make profile header scroll along with contents. AccountTimeline, Followers and Following are no longer

nested inside a common parent (<Account>), instead they all embed <HeaderContainer />
This commit is contained in:
Eugen Rochko
2017-01-30 21:40:55 +01:00
parent a2a85e8549
commit f21e7d6ac0
14 changed files with 230 additions and 182 deletions

View File

@ -8,6 +8,10 @@ import {
} from '../../actions/accounts';
import { ScrollContainer } from 'react-router-scroll';
import AccountContainer from '../../containers/account_container';
import Column from '../ui/components/column';
import HeaderContainer from '../account_timeline/containers/header_container';
import LoadMore from '../../components/load_more';
import ColumnBackButton from '../../components/column_back_button';
const mapStateToProps = (state, props) => ({
accountIds: state.getIn(['user_lists', 'following', Number(props.params.accountId), 'items'])
@ -41,21 +45,35 @@ const Following = React.createClass({
}
},
handleLoadMore (e) {
e.preventDefault();
this.props.dispatch(expandFollowing(Number(this.props.params.accountId)));
},
render () {
const { accountIds } = this.props;
if (!accountIds) {
return <LoadingIndicator />;
return (
<Column>
<LoadingIndicator />
</Column>
);
}
return (
<ScrollContainer scrollKey='following'>
<div className='scrollable' onScroll={this.handleScroll}>
<div>
{accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)}
<Column>
<ColumnBackButton />
<ScrollContainer scrollKey='following'>
<div className='scrollable' onScroll={this.handleScroll}>
<div>
<HeaderContainer accountId={this.props.params.accountId} />
{accountIds.map(id => <AccountContainer key={id} id={id} withNote={false} />)}
<LoadMore onClick={this.handleLoadMore} />
</div>
</div>
</div>
</ScrollContainer>
</ScrollContainer>
</Column>
);
}