mdbootstrap / TW-Elements-React

TW Elements for React - 𝙃𝙪𝙜𝙚 collection of Tailwind + React components, sections and templates 😎
https://tw-elements.com/docs/react/
MIT License
139 stars 27 forks source link

Collapse - Content resizing within a Collapse-Component #172

Open iprzybysz opened 6 months ago

iprzybysz commented 6 months ago

Discussed in https://github.com/mdbootstrap/TW-Elements-React/discussions/171

Originally posted by **SergejGleithmann** May 19, 2024 Hello, I observed, that the Collapse-Component makes use of style attributes instead of using Tailwind classes for showing and hiding the Collapse-Component. Maybe I am missing the point, but imo this is bad, because the height is set to an absolute px value and therefore does not adjust if content within the collapse comonent changes size. I think it would be better, if the height is not set via the style tag or at least omit the positiv height in case of an opened Collape-Component.
SergejGleithmann commented 2 months ago

Hello, I think I might have a solution: The Collapse Element handles the resize event correctly. Now as far as I can tell it would be sufficient to trigger the handleResize function, when the children of the element are changing. I am not familliar with TypeScript, so I feel unqualified to implement this.