Skip to content
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

Merged
merged 3 commits into from
Sep 8, 2016
Merged

feat(Header): Add subheader prop #476

merged 3 commits into from
Sep 8, 2016

Conversation

layershifter
Copy link
Member

This PR fixes #461.

@codecov-io
Copy link

codecov-io commented Sep 8, 2016

Current coverage is 98.62% (diff: 100%)

Merging #476 into master will increase coverage by <.01%

@@             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          

Powered by Codecov. Last update bcfa683...f6cc00e

{createIcon(icon)}
{content && <HeaderContent>{content}</HeaderContent>}
{subheader && <HeaderSubheader content={subheader} />}
Copy link
Member Author

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>
)
Copy link
Member

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>
  )

@levithomason
Copy link
Member

Will merge after the Header render is updated to strictly render children or shorthand, but not both.

@levithomason levithomason merged commit 7bc9632 into master Sep 8, 2016
@levithomason levithomason deleted the feat/sub-header branch September 8, 2016 18:21
@levithomason
Copy link
Member

levithomason commented Sep 8, 2016

Released in stardust@0.42.2, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Header: add subheader shorthand
4 participants