FigmaToCode icon indicating copy to clipboard operation
FigmaToCode copied to clipboard

pxToTailwind never returns null

Open allain opened this issue 1 year ago • 1 comments

Hello.

I was diving into the code and noticed that pxToTailwind doesn't seem to ever return null but it is documented as possibly returning it.

When round is true, it will find the nearest key in the map and return its value (which is always a string it seems).

When round is false, it will return a string with the exact pixels specified.

If this is corrected, a good number of truthy checks in other conversion functions could likely be removed.

https://github.com/bernaferrari/FigmaToCode/blob/a783b5c8cab4e88a98e8988eb921dcab473e2153/packages/backend/src/tailwind/conversionTables.ts#L53

allain avatar Oct 18 '24 12:10 allain

Thanks!!

bernaferrari avatar Mar 08 '25 00:03 bernaferrari