Browse Source

Fix followers/follows layout issues from #8418 (#8505)

* Add alwaysShowScrollbar prop to ScrollableList

* Fix followers/follows layout issues from #8418
pull/4/head
Jakub Mendyk 4 years ago
committed by Eugen Rochko
parent
commit
ceed1ebe5b
3 changed files with 12 additions and 7 deletions
  1. +6
    -3
      app/javascript/mastodon/components/scrollable_list.js
  2. +3
    -2
      app/javascript/mastodon/features/followers/index.js
  3. +3
    -2
      app/javascript/mastodon/features/following/index.js

+ 6
- 3
app/javascript/mastodon/components/scrollable_list.js View File

@ -26,6 +26,7 @@ export default class ScrollableList extends PureComponent {
hasMore: PropTypes.bool,
prepend: PropTypes.node,
alwaysPrepend: PropTypes.bool,
alwaysShowScrollbar: PropTypes.bool,
emptyMessage: PropTypes.node,
children: PropTypes.node,
};
@ -141,7 +142,7 @@ export default class ScrollableList extends PureComponent {
}
render () {
const { children, scrollKey, trackScroll, shouldUpdateScroll, isLoading, hasMore, prepend, alwaysPrepend, emptyMessage, onLoadMore } = this.props;
const { children, scrollKey, trackScroll, shouldUpdateScroll, isLoading, hasMore, prepend, alwaysPrepend, alwaysShowScrollbar, emptyMessage, onLoadMore } = this.props;
const { fullscreen } = this.state;
const childrenCount = React.Children.count(children);
@ -172,11 +173,13 @@ export default class ScrollableList extends PureComponent {
</div>
);
} else {
const scrollable = alwaysShowScrollbar;
scrollableArea = (
<div style={{ flex: '1 1 auto', display: 'flex', flexDirection: 'column' }}>
<div className={classNames({ scrollable, fullscreen })} ref={this.setRef} style={{ flex: '1 1 auto', display: 'flex', flexDirection: 'column' }}>
{alwaysPrepend && prepend}
<div className='empty-column-indicator' ref={this.setRef}>
<div className='empty-column-indicator'>
{emptyMessage}
</div>
</div>

+ 3
- 2
app/javascript/mastodon/features/followers/index.js View File

@ -66,13 +66,14 @@ export default class Followers extends ImmutablePureComponent {
<Column>
<ColumnBackButton />
<HeaderContainer accountId={this.props.params.accountId} hideTabs />
<ScrollableList
scrollKey='followers'
hasMore={hasMore}
onLoadMore={this.handleLoadMore}
shouldUpdateScroll={shouldUpdateScroll}
prepend={<HeaderContainer accountId={this.props.params.accountId} hideTabs />}
alwaysPrepend
alwaysShowScrollbar
emptyMessage={emptyMessage}
>
{accountIds.map(id =>

+ 3
- 2
app/javascript/mastodon/features/following/index.js View File

@ -66,13 +66,14 @@ export default class Following extends ImmutablePureComponent {
<Column>
<ColumnBackButton />
<HeaderContainer accountId={this.props.params.accountId} hideTabs />
<ScrollableList
scrollKey='following'
hasMore={hasMore}
onLoadMore={this.handleLoadMore}
shouldUpdateScroll={shouldUpdateScroll}
prepend={<HeaderContainer accountId={this.props.params.accountId} hideTabs />}
alwaysPrepend
alwaysShowScrollbar
emptyMessage={emptyMessage}
>
{accountIds.map(id =>

Loading…
Cancel
Save