treebohotels/leaf-ui

Implement MoreOrLess Component for web

kamleshchandnani opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
Currently there's a MoreOrLess component built which is purely implemented using CSS and was designed for AMP and web, but it has shortcoming when it comes to solve WEB interactions and visual appearance like trimming the text based on characters and showing Show More inline with the text.

Describe the solution you'd like
Implement a MoreOrLess Component which will have the same API as of existing MoreOrLess for AMP with few extra things to handle like how many characters to show initially after which the Show More will be displayed and on click of it the whole text should be displayed.

Hi @kamleshchandnani, I'd like work on this if it's up for grabs. Also, quick questions: since there is already a MoreOrLess component do we just add an extra attribute to accept number of characters and truncate accordingly? In that case should it override the initialHeight attribute or will the new numberOfChars attribute replace it? And what kind of components can be passed as children to MoreOrLess (eg. in the Storybook we are passing a View component (div with text))? Thanks!