Comments (2)
Hey, this looks fantastic! Looking forward to trying it out :)
I'll close this issue, since it's much better handled by the PR you referenced.
Thanks again for the great tool.
from react-multiline-clamping.
Hey Willow!
Love to hear that you found this little library useful :)
I was thinking on what you said and your solution looks great for what you are trying to archieve.
However I think we could maybe invert the show more/less buttons render responsability to the library consumer and that would be much more flexible, allowing more use cases not only passing custom props, classes etc but even entire custom components or maybe another elements and not only buttons.
There was another issue opened that asked about passing another elements instead of buttons and I think we could use this approach to cover both cases.
Take a look to this PR and let me know what you think and if you think it suites your use case :)
With this new API you could do something like this:
<Clamp
withToggle
showMoreElement={({ toggle }) => (
<button type="button" onClick={toggle} className="button-primary">
Show more
</button>
)}
showLessElement={({ toggle }) => (
<button type="button" onClick={toggle} className="button-primary">
Show less
</span>
)}
>
<p>{text}</p>
</Clamp>
And thanks again for your kind words and interest on contributing.
from react-multiline-clamping.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-multiline-clamping.