Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 69871fe

Browse files
committed
feat(wrap): move to tsx
1 parent 726fc37 commit 69871fe

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

packages/layout/src/wrap.ts renamed to packages/layout/src/wrap.tsx

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,20 @@ export const CWrap: ComponentWithProps<WrapProps> = defineComponent({
7979
}))
8080

8181
const childrenToRender = props.shouldWrapChildren
82-
? getValidChildren(slots).map((child, index) =>
83-
h(CWrapItem, { key: index }, child)
84-
)
82+
? getValidChildren(slots).map((child, index) => (
83+
<CWrapItem key={index}>{child}</CWrapItem>
84+
))
8585
: slots
8686

8787
return () => {
88-
return h(
89-
chakra(props.as, {
90-
label: "wrap",
91-
...attrs,
92-
}),
93-
{},
94-
() =>
95-
h(
96-
chakra("ul", { label: "wrap__list", __css: styles.value }),
97-
{},
98-
childrenToRender
99-
)
88+
return (
89+
<chakra.div as={props.as} __label="wrap" {...attrs}>
90+
{() => (
91+
<chakra.ul __label="wrap__list" __css={styles.value}>
92+
{childrenToRender}
93+
</chakra.ul>
94+
)}
95+
</chakra.div>
10096
)
10197
}
10298
},
@@ -107,17 +103,14 @@ export interface WrapItemProps extends HTMLChakraProps<"li"> {}
107103
export const CWrapItem = defineComponent({
108104
setup(_, { attrs, slots }) {
109105
return () => {
110-
return h(
111-
chakra("li", {
112-
label: "wrap__listItem",
113-
__css: {
114-
display: "flex",
115-
alignItems: "flex-start",
116-
},
117-
...attrs,
118-
}),
119-
{},
120-
slots
106+
return (
107+
<chakra.li
108+
__label="wrap__listItem"
109+
__css={{ display: "flex", alignItems: "flex-start" }}
110+
{...attrs}
111+
>
112+
{() => getValidChildren(slots)}
113+
</chakra.li>
121114
)
122115
}
123116
},

0 commit comments

Comments
 (0)