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

bug(Header): Invalid propTypes validation #542

Closed
layershifter opened this issue Sep 24, 2016 · 1 comment
Closed

bug(Header): Invalid propTypes validation #542

layershifter opened this issue Sep 24, 2016 · 1 comment
Labels

Comments

@layershifter
Copy link
Member

We have bug with PropTypes in header.

Warning: Failed prop type: Header prop children conflicts with props: image. They cannot be defined together, choose one or the other.

<h4 class="ui image header">
  <img src="/images/avatar2/small/lena.png" class="ui mini rounded image">
  <div class="content">
    Lena
    <div class="sub header">Human Resources</div>
  </div>
</h4>
<Header as="h4" image>
  <Image src="http://semantic-ui.com/images/avatar2/small/lena.png" shape='rounded' size='mini'/>
  <Header.Content>
    Lena
    <Header.Subheader>Human Resources</Header.Subheader>
  </Header.Content>
</Header>

We can fix this with:

image: customPropTypes.every([
-  customPropTypes.disallow(['children', 'icon']),
+  customPropTypes.disallow(['icon']),
-  PropTypes.oneOfType([
-    PropTypes.string,
-    PropTypes.element,
-    PropTypes.object,
+  customPropTypes.givenProps(
+    { children: PropTypes.node.isRequired },
+    PropTypes.bool,
+  ),
+  customPropTypes.givenProps(
+    { image: PropTypes.oneOfType([PropTypes.string, PropTypes.element, PropTypes.object]) },
+    customPropTypes.disallow(['children']),
+  ),
  ]),
]),

I'll make PR?

@levithomason
Copy link
Member

Yes please :)

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

No branches or pull requests

2 participants