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

Button: attached prop should accept true as value #2104

Closed
kasbah opened this issue Sep 22, 2017 · 3 comments · Fixed by #2105
Closed

Button: attached prop should accept true as value #2104

kasbah opened this issue Sep 22, 2017 · 3 comments · Fixed by #2105
Labels

Comments

@kasbah
Copy link
Contributor

kasbah commented Sep 22, 2017

Steps

Add a Button with boolean attached prop

Expected Result

No warnings

Actual Result

Warning logged:

"Warning: Failed prop type: Invalid prop `attached` of value `true` supplied to `t`, expected one of ['left','right','top','bottom'].
    in t (created by App)
    in App"

Version

0.67.1

Testcase

https://codepen.io/anon/pen/YrGjqx?editors=1112

@layershifter
Copy link
Member

The attached prop can take only one from these values: left, right, top, bottom. Why do think that it can accept boolean?

Button docs

@kasbah
Copy link
Contributor Author

kasbah commented Sep 22, 2017

Because that's how the Segment works. A value of true (i.e. just adding the prop without an =) means attached in the middle. There is no other way to attach in the middle. It currently works with buttons as well but gives a warning. I think the warning is invalid and bool should be added to the proptypes.

@layershifter
Copy link
Member

layershifter commented Sep 22, 2017

Hm, seems you're right. Nice catch 👍

  <div>
    <Button attached='top'>Top</Button>
    <Button attached>Middle</Button>
    <Button attached='bottom'>Bottom</Button>
  </div>

This looks like valid markup. As I see we can to update propTypes, classNames and tests on Button and Button.Group. It should work in same way as Segment.

@layershifter layershifter reopened this Sep 22, 2017
kasbah added a commit to kasbah/Semantic-UI-React that referenced this issue Sep 22, 2017
kasbah added a commit to kasbah/Semantic-UI-React that referenced this issue Sep 22, 2017
kasbah added a commit to kasbah/Semantic-UI-React that referenced this issue Sep 22, 2017
@layershifter layershifter changed the title Invalid prop attached of value true supplied to Button Button: attached prop should accept true as value Sep 23, 2017
levithomason pushed a commit that referenced this issue Sep 23, 2017
* fix(Button): Add bool to propTypes of attached

fixes #2104

* fix(ButtonGroup): handling of bool attached prop

* style(ButtonGroup): Reorder some things
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants