Using multiple Slots within a Component
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 48/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 with the Code Connect documentation and the implementation of figma.children and figma.instance to determine whether multiple named slots can be mapped independently. The issue provides no source files or tests to begin from, so first identify the relevant API entry points and existing slot tests. Done means documenting or supporting a clear way to connect both content and action slots in one component.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I'll start by saying that I'm not developer and my knowledge of React and Code Connect has been self taught. I apologize if this can already be done and I'm just missing something...
We have a component where we have multiple Props that we are using Slots for:
<ComponentName
content={}
actions={}
/>
Here's an example of our figma.tsx
import { ComponentName } from '@something';
import figma from `@figma/code-connect`;
const FigmaLink = "..."
const ComponentNameProps = {
content: figma.boolean("Content", {
false: undefined,
true: figma.children('ContentSlot')
}),
action: figma.boolean("Action", {
false: undefined,
true: figma.children('ActionSlot')
})
};
figma.connect(ComponentName, FigmaLink , {
props: {
...ComponentNameProps,
},
example: ({ content, action }) => {
return <ComponentName content={content} action={action} />;
}
});
Note: we separate our Links and Props whenever we use different variant use case examples.
In previous cases where we used Slots, it was set as children with a catchall (figma.children('*')) and this works great. I'm struggling to find a way of implementing the Code Connect for these components without having to create subComponents using the catch all method:
I haven't tested this but this is what I would do in that case:
_ComponentNameContent and _ComponentNameAction:
import { Fragment } from '@something';
import figma from `@figma/code-connect`;
figma.connect(
Fragment,
'...',
{
props: {
children: figma.children('*'),
}.
example: ({ children }) => (
<Fragment>{children}</Fragment>
)
}
)
Then the Code Connect would be:
import { ComponentName } from '@something';
import figma from `@figma/code-connect`;
const FigmaLink = "..."
const ComponentNameProps = {
content: figma.boolean("Content", {
false: undefined,
true: figma.instance('_ComponentNameContent')
}),
action: figma.boolean("Action", {
false: undefined,
true: figma.children('_ComponentNameAction')
})
};
figma.connect(ComponentName, FigmaLink , {
props: {
...ComponentNameProps,
},
example: ({ content, action }) => {
return <ComponentName content={content} action={action} />;
}
});
Sorry if there's some errors, I had to type this all up from my personal computer since I don't have access to GH on my work computer. Does anyone have any thoughts/solutions?
- 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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của figma/code-connect
-
normalizePropName strips `#` characters from Figma property names instead of only the `#id` suffixĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
figma/code-connect#419 ·
-
feature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
figma/code-connect#403 ·
-
feature request
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
figma/code-connect#414 ·
-
feature request
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
figma/code-connect#413 · 1 bình luận ·
-
feature request
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
figma/code-connect#412 · 1 bình luận ·
Tất cả issue của figma/code-connect
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
vercel-labs/ui#540 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accepted ai-dev ai-implementing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
livesport/homer#218 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Negative values skip k/M abbreviation and medium decimal format on line, stacked-area, and tooltipĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
britecharts/britecharts#1255 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
jeanibarz/knowledge-base-mcp-server#1268 ·
Maintainer thường phản hồi trong vòng 1 ngày