figma2html icon indicating copy to clipboard operation
figma2html copied to clipboard

Add option for responsive iFrames

Open lajoiemedia opened this issue 2 years ago • 1 comments

Describe the problem

Currently, using a chart produced by figma2html in an iFrame is difficult if the chart changes heights. Even if it doesn't, the host page for the iFrame needs to specify the height of the iFrame. That's not ideal.

Describe the proposed solution

There should be a checkbox to automatically include a responsive iFrame script such as pym.js as well as the javascript to enable the chart to work as a child page. Then it would be a simple matter to use a responsive iFrame in a parent page. That way, the parent page would no longer have to specify a height for the iFrame, and height changes would also be supported.

Alternatives considered

There are other similar libraries such as SideChain, but Pym.js would likely allow the most backwards compatibility.

Importance

would make my life easier

Code of Conduct

  • [X] I agree to follow figma2html's Code of Conduct

lajoiemedia avatar Oct 29 '23 18:10 lajoiemedia

I agree that figma2html working as an embed is important, but I don't necessarily believe making it responsive falls in the scope of figma2html. As figma2html exports .html or .svelte files, you could easily append the responsive javascript to the code afterward or work in your own pipeline.

My concern with making it responsive is that the process requires work not just on figma2html's end but from the user embedding the chart. The target site will require additional code to work. If we were to choose Pym or Sidechain or frames, we would be prescribing to a specific stack that orgs may not use.

That said... are you able to append the code now that the <script> tag is fixed (thank you for that PR!)

sawyerclick avatar Nov 08 '23 18:11 sawyerclick