Added isAddable prop to GroupCollectionItem
• Added: - isAddable prop to GroupCollectionItem
This commit is contained in:
parent
d198695bdb
commit
421111f5f2
@ -9,6 +9,7 @@ import { PLACEHOLDER_MISSING_HEADER_SRC, CX } from '../constants'
|
|||||||
import { shortNumberFormat } from '../utils/numbers'
|
import { shortNumberFormat } from '../utils/numbers'
|
||||||
import Image from './image'
|
import Image from './image'
|
||||||
import Text from './text'
|
import Text from './text'
|
||||||
|
import GroupActionButton from './group_action_button'
|
||||||
|
|
||||||
class GroupCollectionItem extends ImmutablePureComponent {
|
class GroupCollectionItem extends ImmutablePureComponent {
|
||||||
|
|
||||||
@ -18,6 +19,7 @@ class GroupCollectionItem extends ImmutablePureComponent {
|
|||||||
group,
|
group,
|
||||||
relationships,
|
relationships,
|
||||||
isHidden,
|
isHidden,
|
||||||
|
isAddable,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
if (!relationships) return null
|
if (!relationships) return null
|
||||||
@ -28,7 +30,6 @@ class GroupCollectionItem extends ImmutablePureComponent {
|
|||||||
const coverSrc = group.get('cover_image_url') || ''
|
const coverSrc = group.get('cover_image_url') || ''
|
||||||
const coverMissing = coverSrc.indexOf(PLACEHOLDER_MISSING_HEADER_SRC) > -1 || !coverSrc
|
const coverMissing = coverSrc.indexOf(PLACEHOLDER_MISSING_HEADER_SRC) > -1 || !coverSrc
|
||||||
|
|
||||||
|
|
||||||
if (isHidden) {
|
if (isHidden) {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
@ -55,6 +56,9 @@ class GroupCollectionItem extends ImmutablePureComponent {
|
|||||||
bgSubtle_onHover: isMember,
|
bgSubtle_onHover: isMember,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let groupTitle = group.get('title') || ''
|
||||||
|
if (isAddable && groupTitle.length > 52) groupTitle = `${groupTitle.substring(0, 52).trim()}...`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={_s.d}>
|
<div className={_s.d}>
|
||||||
<NavLink
|
<NavLink
|
||||||
@ -116,7 +120,7 @@ class GroupCollectionItem extends ImmutablePureComponent {
|
|||||||
|
|
||||||
<div className={[_s.d, _s.px10, _s.my10].join(' ')}>
|
<div className={[_s.d, _s.px10, _s.my10].join(' ')}>
|
||||||
<Text color='primary' size='medium' weight='bold'>
|
<Text color='primary' size='medium' weight='bold'>
|
||||||
{group.get('title')}
|
{groupTitle}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<div className={[_s.d, _s.flexRow, _s.aiCenter, _s.mt5, _s.mb5].join(' ')}>
|
<div className={[_s.d, _s.flexRow, _s.aiCenter, _s.mt5, _s.mb5].join(' ')}>
|
||||||
@ -126,6 +130,13 @@ class GroupCollectionItem extends ImmutablePureComponent {
|
|||||||
{intl.formatMessage(messages.members)}
|
{intl.formatMessage(messages.members)}
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{
|
||||||
|
isAddable &&
|
||||||
|
<div className={[_s.d, _s.pt10].join(' ')}>
|
||||||
|
<GroupActionButton group={group} relationships={relationships} />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</NavLink>
|
</NavLink>
|
||||||
@ -152,6 +163,7 @@ GroupCollectionItem.propTypes = {
|
|||||||
group: ImmutablePropTypes.map,
|
group: ImmutablePropTypes.map,
|
||||||
relationships: ImmutablePropTypes.map,
|
relationships: ImmutablePropTypes.map,
|
||||||
isHidden: PropTypes.bool,
|
isHidden: PropTypes.bool,
|
||||||
|
isAddable: PropTypes.bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default injectIntl(connect(mapStateToProps)(GroupCollectionItem))
|
export default injectIntl(connect(mapStateToProps)(GroupCollectionItem))
|
Loading…
x
Reference in New Issue
Block a user