Issue handling function passed as children in React components

Đang mở
#333 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
react, typescript
Lĩnh vực
developer-experience

Hướng nghiên cứu

Start by tracing how Code Connect handles figma.children("*") and renders the example callback in its React support; the issue does not name relevant files or tests. Check how function-valued children are represented and whether slot attributes can be forwarded. Done means documenting or supporting a way to render the function child and pass its attributes to the rendered component; the issue has had no comment for 243 days.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

API question

Please provide:

  • Code Connect CLI version: 1.3.6
  • Operating system: macOS Sequoia 15.0
  • Code Connect file, Figma design and/or relevant code snippet that could help us get more context:

I have a React component where I’m using an arrow function as children to pass click events and other attributes down to a slot node (in this case, a Button):

<DropdownMenu.Trigger>
    {(attributes) => <Button attributes={attributes}>Open</Button>}
</DropdownMenu.Trigger>

However, when I try to connect it using Code Connect, the API doesn’t seem to handle a function passed as children for DropdownMenu.Trigger.

Here’s my setup:

figma.connect(
	DropdownMenu.Trigger,
	"https://www.figma.com/design/...,
	{
		imports: ["import { DropdownMenu } from '@library'"],
		props: {
			children: figma.children("*"),
		},
		example: ({ children }) => <DropdownMenu.Trigger>{(attributes) => children}</DropdownMenu.Trigger>,
	}
);

Result:

Image

Additionally, how can we pass the attributes parameter down to whatever component is rendered inside the slot?

Thank you!

Ngôn ngữ chính
TypeScript
Star
1.6k
Fork
126
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của figma/code-connect

Tất cả issue của figma/code-connect

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.