-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(Header): Add subheader prop #476
Conversation
Current coverage is 98.62% (diff: 100%)@@ master #476 diff @@
==========================================
Files 101 101
Lines 1444 1450 +6
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 1424 1430 +6
Misses 20 20
Partials 0 0
|
{createIcon(icon)} | ||
{content && <HeaderContent>{content}</HeaderContent>} | ||
{subheader && <HeaderSubheader content={subheader} />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems, I missed test-case there.
{children || content} | ||
{subheader && <HeaderSubheader content={subheader} />} | ||
</ElementType> | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the Header will render children with shorthand even though there are prop type warnings. While we're here, let's split this return with a conditional return to only render children if provided. The goal in doing this in all components is to enforce proper usage (not rendering shorthand when children are present):
if (children) {
return (
<ElementType {...rest} className={classes}>
{children}
</ElementType>
)
}
return (
<ElementType {...rest} className={classes}>
{content}
{subheader && <HeaderSubheader content={subheader} />}
</ElementType>
)
Will merge after the Header render is updated to strictly render children or shorthand, but not both. |
Released in |
This PR fixes #461.