Support for parsing instance().getProps() in nested props
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 49/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- typescript
调研方向
Start by tracing how figma.nestedProps, figma.enum, and figma.instance().getProps() are parsed and emitted, using the example in the issue as the expected case. Check the relevant parser and output tests, then add coverage for the nested icon property mapping; done means the generated example preserves the requested instance property only when its enum condition is true.
由索引模型根据 Issue 内容生成。
描述
Our UX team is using nested components for reusability in Figma which has created a challenge for us when hooking it up to code connect. It seems like code connect isn't parsing instance().getProps in this example:
import figma from "@figma/code-connect";
import { Button } from "./DesignSystem/Button";
figma.connect(
Button,
"https://www.figma.com/design/example",
{
props: {
type: figma.string("type"),
disabled: figma.enum("state", {
default: false,
hover: false,
disabled: true,
}),
buttonBaseProps: figma.nestedProps(".button-base", {
size: figma.string("size"),
label: figma.string("label"),
leftIcon: figma.enum("has-left-icon", {
true: figma.instance("left-icon").getProps().type,
false: undefined,
}),
rightIcon: figma.enum("has-right-icon", {
true: figma.instance("right-icon").getProps().type,
false: undefined,
}),
}),
},
example: ({ type, disabled, buttonBaseProps }: { type: any; disabled: boolean; buttonBaseProps: any }) => (
<Button
type={type}
size={buttonBaseProps.size}
leftIcon={buttonBaseProps.leftIcon}
rightIcon={buttonBaseProps.rightIcon}
label={buttonBaseProps.label}
disabled={disabled}
onPress={() => {}}
/>
),
}
);
Output in Figma:
import { Button } from "./DesignSystem/Button"
<Button
type="primary"
size="small"
rightIcon={figma.instance("right-icon").getProps().type}
label="Button"
onPress={() => {}}
/>
Since we also need to handle the nested has-right-icon properties, it makes sense to use the enum to try to map the icon only when it's present. But then we need to access the type prop for the instance, as we are not passing the icon component to the button, just the type.
- 主要语言
- TypeScript
- 星标
- 1.6k
- 派生
- 126
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
figma/code-connect 的其他 Issue
-
normalizePropName strips `#` characters from Figma property names instead of only the `#id` suffix未关闭
难度 2/5 1-3 小时 新手友好度 72/100
figma/code-connect#419 ·
-
feature request
难度 2/5 1-3 小时 新手友好度 66/100
figma/code-connect#403 ·
-
feature request
难度 5/5 一周以上 新手友好度 38/100
figma/code-connect#414 ·
-
feature request
难度 4/5 3-5 天 新手友好度 48/100
figma/code-connect#413 · 1 条评论 ·
-
feature request
难度 4/5 3-5 天 新手友好度 54/100
figma/code-connect#412 · 1 条评论 ·
查看 figma/code-connect 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
vercel-labs/ui#540 ·
维护者通常 1 天内回复
-
accepted ai-dev ai-implementing
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
Negative values skip k/M abbreviation and medium decimal format on line, stacked-area, and tooltip未关闭
难度 2/5 1-3 小时 新手友好度 84/100
britecharts/britecharts#1255 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 70/100
jeanibarz/knowledge-base-mcp-server#1268 ·
维护者通常 1 天内回复