-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Show More buttons with carets w/ counts
- Loading branch information
Showing
6 changed files
with
84 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react'; | ||
|
||
export default class ShowMore extends React.Component { | ||
|
||
constructor(props, context) { | ||
super(props, context); | ||
this.handleClick = this.handleClick.bind(this); | ||
} | ||
|
||
handleClick(ev) { | ||
ev.preventDefault(); | ||
this.props.handleClick(); | ||
} | ||
|
||
render() { | ||
const { collection, notShown, expanded, hideNumber } = this.props; | ||
const showLimitAction = collection && (expanded || notShown > 0); | ||
const limitActionText = !hideNumber && !expanded && notShown > 0 ? `+${notShown}` : ''; | ||
const limitActionIcon = !expanded && notShown > 0 ? 'fa fa-caret-down' : 'fa fa-caret-up'; | ||
|
||
if (!showLimitAction) { | ||
return <span/>; | ||
} | ||
return ( | ||
<div className="show-more" onClick={this.handleClick}> | ||
{limitActionText} <span className={'show-more-icon ' + limitActionIcon}/> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters