figma.nestedProps inside figma.className

Đang mở
#315 2 bình luận 1 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
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
figma, typescript
Lĩnh vực
tooling

Hướng nghiên cứu

Start by reading the Code Connect CLI handling for figma.className and figma.nestedProps, then trace how the example receives the resulting className value. Reproduce the reported case with the provided snippet and check how nested size and color values are serialized. Done means the generated class string no longer contains [object Object] and the nested value can be used as intended; the issue does not name files or tests.

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.4
  • Code Connect file, Figma design and/or relevant code snippet that could help us get more context

Actual code is s

figma.connect('....', {
    props: {
        className: figma.className([
            figma.nestedProps('_tags (main)', {
                size: figma.enum('Size', {
                    md: 'md',
                    sm: 'sm'
                })
            }),
            figma.enum('Color', {
                Black: 'black',
                White: 'white',
                Red: 'red',
                Blue: 'blue'
            })
        ])
    },
    example: ({ className }) => html`<div class="${className}">DIV</div>`
});

Issue is:
Result is

<div class="[object Object] black">TAG</div>

Probably because of "nestedProps"
But thing is:

  • I CAN'T create the className inside "example".
  • I CAN'T use Size outside of nested because ... it's a nested properties
  • I CAN'T update a bit code and do class="${nested.size} ${variant} because the result is class="black" md" (yeah there is a random ")

So the question is, how to fix that ? Is that even fixable ?

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.