-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NODE_LI] renders <p> #43
Comments
Found the answer to the first question in issue#36 [NODE_LI]: (children) => {
if (Children.count(children) === 1) {
const child = Children.toArray(children)[0];
if (isValidElement(child)) {
// Check if child is a valid React element
if (child.type === "p") {
return <li>{child.props.children}</li>;
}
}
}
return null;
} |
Can you tell me more about what you want to achieve? There is only one kind of |
My intention is to render a different [NODE_LI]: (children) => {
const childElements = Children.map(children, (child) => {
if (isValidElement(child)) {
const isULItem = child.props.children[0] === "UL Item";
const textStyleClass = isULItem
? "text-sm md:text-md 2xl:text-base"
: "text-purple text-sm md:text-md 2xl:text-base";
if (child.type === "p") {
return (
<li
key={child.key}
className={`py-2 md:py-4 2xl:py-6 ${textStyleClass}`}
>
<span>{child.props.children}</span>
</li>
);
}
}
return null;
});
return <>{childElements}</>;
},
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
children is rendered with a wrapping
<p>
tag which causes design issues. How can this be avoided.Other question, how do you render different
<li>
depending if parent is<ul>
or<ol>
?The text was updated successfully, but these errors were encountered: