Open konki-vienna opened 2 months ago
Hey @konki-vienna! Yeah this is a bug, unfortunately undefined
values resolve to empty strings. However you might be able to get around this if it's just a single string like in your example, by using only enum
:
className: figma.enum('Background', {
'On Product': 'g-inverted'
})
We'll look into fixing this!
We have a Button component that behaves differently on different backgrounds. With the Figma prop Background = "On Product" a className "g-inverted" needs to be added to the React code. With the Figma prop "Background = "On Neutral" no className is needed.
The code-connect code className: figma.className([ figma.enum('Background', { 'On Product': 'g-inverted' }), figma.enum('Background', { 'On Neutral': undefined }), ]), adds the "g-inverted" className property correctly, if Background="On Product", however if Background ="On Neutral", the property 'className=""' gets added to the code snippet.
Have I misconfigured something or can't this be achieved?