Updated Status component to use SortBlock component

• Updated:
- Status component to use SortBlock component
This commit is contained in:
mgabdev 2020-08-05 23:31:41 -05:00
parent 3c537e1f1f
commit a6206bb13b
1 changed files with 8 additions and 25 deletions

View File

@ -21,6 +21,7 @@ import StatusHeader from './status_header'
import CommentList from './comment_list' import CommentList from './comment_list'
import Button from './button' import Button from './button'
import Text from './text' import Text from './text'
import SortBlock from './sort_block'
import ColumnIndicator from './column_indicator' import ColumnIndicator from './column_indicator'
// We use the component (and not the container) since we do not want // We use the component (and not the container) since we do not want
@ -377,19 +378,15 @@ class Status extends ImmutablePureComponent {
} }
} }
handleOnCommentSortOpen = () => { handleOnCommentSortOpen = (btn) => {
this.props.onCommentSortOpen(this.commentSortButtonRef) this.props.onCommentSortOpen(btn)
} }
handleRef = c => { handleRef = (c) => {
this.node = c this.node = c
this._measureHeight() this._measureHeight()
} }
setCommentSortButtonRef = (c) => {
this.commentSortButtonRef = c
}
render() { render() {
const { const {
intl, intl,
@ -602,24 +599,10 @@ class Status extends ImmutablePureComponent {
<Fragment> <Fragment>
<div className={[_s.default, _s.mr10, _s.ml10, _s.mb10, _s.borderColorSecondary, _s.borderBottom1PX].join(' ')} /> <div className={[_s.default, _s.mr10, _s.ml10, _s.mb10, _s.borderColorSecondary, _s.borderBottom1PX].join(' ')} />
<div className={[_s.default, _s.px15, _s.py5, _s.mb5, _s.flexRow].join(' ')}> <SortBlock
<Text color='secondary' size='small'> value={sortByTitle}
{intl.formatMessage(messages.sortBy)} onClickValue={this.handleOnCommentSortOpen}
</Text> />
<Button
isText
backgroundColor='none'
color='secondary'
className={_s.ml5}
buttonRef={this.setCommentSortButtonRef}
onClick={this.handleOnCommentSortOpen}
disabled={descendantsIds.size === 0}
>
<Text color='inherit' weight='medium' size='small'>
{sortByTitle}
</Text>
</Button>
</div>
{ {
descendantsIds.size === 0 && descendantsIds.size === 0 &&