`figma connect preview` support for nested components props

未關閉
#412 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
54/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
figma, typescript

研究方向

Start by locating the figma connect preview command and the code that builds the --inspect and --output json property lists. Check how nested component instances are represented in the Figma data and compare that with the current boolean output for “Assistive text.” Done means both preview formats report nested component properties accurately so they can be used to test templates.

由索引模型根據 Issue 內容生成。

描述

feature request

Recently I started to experiment with the CLI preview feature and notice it can only receive props that belong strictly to the component.

Often my team designers share components that rely on nested instances. See in the image below the "Assistive text" nested component:

Image

As you can see in the image below, the nested component value is a relevant prop for the component code:

Image

When I run the preview command with the --inspect flag, Assistive text is represented as a boolean, which is not the case - it's a nested component.

● components.figma.batch.json (198:33673)
  Name                      Type     Options                                      Default
  ------------------------  -------  -------------------------------------------  ---------
  [𝐓] Label                Text                                                  "Label"
  Trailing label (Default)  Boolean  true | false                                 true
  Assistive text            Boolean  true | false                                 false
  Leading label             Boolean  true | false                                 false
  Selection                 Variant  None | Selected | Partial                    "None"
  State                     Variant  Default | Hover | Active | Focus | Disabled  "Default"
  Error                     Variant  True | False                                 "False"

Similar output is generated with --output json:

[
  {
    "filePath": "components.figma.batch.json",
    "nodeId": "198:33673",
    "availableProperties": [
      {
        "name": "[𝐓] Label",
        "type": "TEXT",
        "default": "Label"
      },
      {
        "name": "Trailing label (Default)",
        "type": "BOOLEAN",
        "default": true
      },
      {
        "name": "Assistive text",
         "type": "BOOLEAN",
        "default": false
      },
      {
        "name": "Leading label",
        "type": "BOOLEAN",
        "default": false
      },
      {
        "name": "Selection",
        "type": "VARIANT",
        "variantOptions": [
          "None",                                                                                       "Selected",
          "Partial"
        ],
        "default": "None"
      },
      {
        "name": "State",
        "type": "VARIANT",
        "variantOptions": [
          "Default",
          "Hover",
          "Active",
          "Focus",
          "Disabled"
        ],
        "default": "Default"
      },
      {
        "name": "Error",
        "type": "VARIANT",
        "variantOptions": [
          "True",
          "False"
        ],
        "default": "False"
      }                                                                                           ]
  }
]

Being able to test the templates with the nested component values is quite relevant for our team to ensure these are working as we designed them.

主要語言
TypeScript
星號
1.6k
分支
126
PR 合併指標
30 天內沒有已合併 PR

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

figma/code-connect 的其他 Issue

查看 figma/code-connect 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。