@react-email/section 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -1
- package/dist/index.mjs +8 -1
- package/package.json +1 -1
- package/readme.md +4 -1
package/dist/index.js
CHANGED
|
@@ -44,6 +44,13 @@ var Section = React.forwardRef(
|
|
|
44
44
|
gridAutoColumns: "minmax(0, 1fr)",
|
|
45
45
|
gridAutoFlow: "column"
|
|
46
46
|
};
|
|
47
|
+
const arrayChildren = React.Children.toArray(children);
|
|
48
|
+
const hasTdElement = (child) => {
|
|
49
|
+
return React.isValidElement(child) && child.type === "td";
|
|
50
|
+
};
|
|
51
|
+
const finalChildren = arrayChildren.map((child, index) => {
|
|
52
|
+
return hasTdElement(child) ? child : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: child }, index);
|
|
53
|
+
});
|
|
47
54
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
55
|
"table",
|
|
49
56
|
{
|
|
@@ -55,7 +62,7 @@ var Section = React.forwardRef(
|
|
|
55
62
|
cellSpacing: 0,
|
|
56
63
|
role: "presentation",
|
|
57
64
|
...props,
|
|
58
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { style: styleDefaultTr, children }) })
|
|
65
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { style: styleDefaultTr, children: finalChildren }) })
|
|
59
66
|
}
|
|
60
67
|
);
|
|
61
68
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,13 @@ var Section = React.forwardRef(
|
|
|
12
12
|
gridAutoColumns: "minmax(0, 1fr)",
|
|
13
13
|
gridAutoFlow: "column"
|
|
14
14
|
};
|
|
15
|
+
const arrayChildren = React.Children.toArray(children);
|
|
16
|
+
const hasTdElement = (child) => {
|
|
17
|
+
return React.isValidElement(child) && child.type === "td";
|
|
18
|
+
};
|
|
19
|
+
const finalChildren = arrayChildren.map((child, index) => {
|
|
20
|
+
return hasTdElement(child) ? child : /* @__PURE__ */ jsx("td", { children: child }, index);
|
|
21
|
+
});
|
|
15
22
|
return /* @__PURE__ */ jsx(
|
|
16
23
|
"table",
|
|
17
24
|
{
|
|
@@ -23,7 +30,7 @@ var Section = React.forwardRef(
|
|
|
23
30
|
cellSpacing: 0,
|
|
24
31
|
role: "presentation",
|
|
25
32
|
...props,
|
|
26
|
-
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx("tr", { style: styleDefaultTr, children }) })
|
|
33
|
+
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx("tr", { style: styleDefaultTr, children: finalChildren }) })
|
|
27
34
|
}
|
|
28
35
|
);
|
|
29
36
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -33,10 +33,13 @@ Add the component to your email template. Include styles where needed.
|
|
|
33
33
|
|
|
34
34
|
```jsx
|
|
35
35
|
import { Section } from '@react-email/section';
|
|
36
|
+
import { Text } from '@react-email/text';
|
|
36
37
|
|
|
37
38
|
const Section = () => {
|
|
38
39
|
return (
|
|
39
|
-
<Section>
|
|
40
|
+
<Section>
|
|
41
|
+
<Text>Hello World</Text>
|
|
42
|
+
<Section />
|
|
40
43
|
);
|
|
41
44
|
};
|
|
42
45
|
```
|