Giter VIP home page Giter VIP logo

Comments (2)

WillowP avatar WillowP commented on August 24, 2024 1

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.

mikelpmc avatar mikelpmc commented on August 24, 2024

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 :)

#19

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.