Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement Code Connect if in Figma have a toggle #70

Closed
pttchsswk opened this issue Jun 24, 2024 · 4 comments
Closed

How to implement Code Connect if in Figma have a toggle #70

pttchsswk opened this issue Jun 24, 2024 · 4 comments

Comments

@pttchsswk
Copy link

in Figma I have a toggle "is Unavailable" (can be "Yes", "No")
Screenshot 2567-06-24 at 13 59 04

in component.figma.tsx

  AvatarCTA,
  "https://www.figma.com/design/213213213wasfasdasdsad/asdsadasdsad-%26-Organisms?node-id=13-sssad&m=dev",
  {
    props: {
      label: figma.string("Label"),
      showDescription: figma.boolean("show Description"),
      isUnavailable: figma.boolean("is Unavailable"),
    },
    example: (props) => <AvatarCTA isUnAvailable={props.isUnavailable} />,
  }
);```

I want to show code in connect at figma like

`<AvatarCTA isUnAvailable={true} /> // when isUnavailable toggle is Yes`
`<AvatarCTA isUnAvailable={false} /> // when isUnavailable toggle is No`

how should I implement?

very urgent please help
@ptomas-figma
Copy link
Collaborator

Hi, this seems like code that should work. What issue are you seeing when publishing?

@pttchsswk
Copy link
Author

Hi @ptomas-figma thanks for your support

this my code
Screenshot 2567-06-25 at 10 10 34

and this is result

  • showIcon props is not visible
    Screenshot 2567-06-25 at 10 09 38

how should I implement code to show showIcon like red text in second image?

@karlpetersson
Copy link

Hi @pttchsswk! Your examples look correct. I'm not able to reproduce this, I'd like to get some more information here if possible. What are the different values of show Icon - is it "Yes" / "No" like in the original post? Could you screenshot what the variant configuration looks like in design mode?

One note is that we omit falsy props entirely, and we pass true like this:

<Button showIcon />

Will this work for you or do you need to be able to explicitly pass false as in showIcon={false} ?

@karlpetersson
Copy link

Hey again - I was able to reproduce this issue now. A possible workaround for this is to rename the values of show Icon to "True" or "False" (case sensitive) in Figma - this seems to be an issue if lowercase values are used like "yes" or "true". Let me know if that works for you. In any case, we'll aim to have this fixed in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants