Map multiple figma properties to a single Compose parameter

Open
#334 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript

Research direction

Start by reading the Code Connect CLI implementation for @FigmaProperty and the Compose mapping definitions. The issue proposes combining a boolean property with a text property to produce one nullable Compose parameter; determine how that mapping should work and what cases it must support. Done means the CLI supports the agreed mapping and its behavior is covered by tests.

Written by the indexing model from the issue text.

Description

feature request

Our designers frequently use 2 figma properties to configure a single optional field. For example, one boolean property indicating whether the field should be shown, and a text property indicating the text value when the field is shown. This corresponds to a single nullable parameter on the Compose side. Would you consider adding this functionality to Code Connect CLI? For example, maybe something like the following where one property can reference a previously defined property?

@FigmaProperty(FigmaType.Text, "Label text")
public val labelText: String = "{label text}"

@FigmaProperty(FigmaType.Boolean, "Optional label")
public val optionalLabel: String? = Figma.mapping(
   true to labelText,
   false to null,
)
Dominant language
TypeScript
Stars
1.6k
Forks
126
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from figma/code-connect

All issues in figma/code-connect

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.