community-plugins icon indicating copy to clipboard operation
community-plugins copied to clipboard

🚀 Feature: Add "auto" option to TechRadar width and height

Open melloc01 opened this issue 1 year ago • 2 comments

🔖 Feature description

Add an "auto" value option to automatically and dynamically set width and height props of the <TechRadarPage /> If there's a way to do this, adding it to the docs would be good.

🎤 Context

The issue that I faced: I was trying to use a useSize hook with the content (BackstageContent-root) width/height and use it for the TechRadar's width and height props dynamically but it's tricky because it needs to be a direct child of FlatRoutes and I still didn't come to a functional JSX hierarchy to make this work.

Is there a way to make its width the width/height of the available content (BackstageContent-root) with custom code?

If not, adding an "auto" option for width or height would be a good solution maybe?

There are some hacky ways to do this bypassing React's lifecycle and accessing the dom directly but I felt it could have a standard API for this.

✌️ Possible Implementation

Using an useSize-like hook to set BackstageContent-root's width and height when prop is set to auto

👀 Have you spent some time to check if this feature request has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

melloc01 avatar Jul 18 '24 16:07 melloc01

Any comments / ideas on this? Otherwise, I'll start creating a PR with the solution proposed, thanks for moving it @benjdlambert!

melloc01 avatar Jul 22 '24 15:07 melloc01

Contributions welcome!

awanlin avatar Jul 30 '24 14:07 awanlin

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Sep 28 '24 18:09 github-actions[bot]