Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new component TextCollapseByLength #460

Merged
merged 2 commits into from
Sep 14, 2018
Merged

Conversation

mqchau
Copy link
Contributor

@mqchau mqchau commented Sep 13, 2018

This component will let us show more or less of a long piece of text

@mqchau mqchau force-pushed the nilTextCollapseByLength branch from 65e846f to 49a7e2d Compare September 13, 2018 22:14
@mqchau
Copy link
Contributor Author

mqchau commented Sep 13, 2018

- Rename to CollapsableText, similar to ExpandableSection
- Rename showMore/showLess to moreLabel/lessLabel to avoid sounding like an action
- Rename shouldShowAll & collapsedByDefault to collapse so that we can use as controlled prop.
- Update propTypes
- Use ellipsis
- Some minor eslint warnings
@gthomas-appfolio gthomas-appfolio merged commit b541d39 into master Sep 14, 2018
@gthomas-appfolio gthomas-appfolio deleted the nilTextCollapseByLength branch September 14, 2018 21:01
} else if (this.state.collapsed) {
return (
<span>
{children.substring(0, maxLength).trim()}&hellip; {this.renderButton(this.expandText, moreLabel)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.expandText would be undefined


return (
<span>
{children} {this.renderButton(this.collapseText, lessLabel)}
Copy link
Contributor

@joelbandi joelbandi Sep 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.collapseText would be undefined

this.setState({ collapsed: !this.state.collapsed });
};

renderButton(callback, buttonText) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the callback being used here? we're using toggle() anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, can you create a PR to correct them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants