-
Notifications
You must be signed in to change notification settings - Fork 429
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
Component/tri state switch #575
Conversation
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.
Looks good apart from the stray console.log :)
@@ -32,13 +32,15 @@ export default class BooleanInput extends React.Component<Props> { | |||
render() { | |||
const {value, type, level, description, ...rest} = this.props | |||
|
|||
console.log('boolean', value) |
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.
Stray console.log
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.
👍
@@ -36,6 +36,10 @@ | |||
composes: root; | |||
} | |||
|
|||
.undefinedChecked { |
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.
Would it be better to call it .indeterminate
?
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.
👍
@@ -38,19 +38,29 @@ export default class Checkbox extends React.Component { | |||
|
|||
setInput = el => { | |||
this._input = el | |||
|
|||
if (typeof value === 'undefined' && el) { |
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.
Could this be moved to componentDidMount
instead? Personally that is the first place I'd look for it and expect it to be. And you don't have to worry about el
(this._input
) being null either.
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.
This applies to Switch as well
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.
👍
73afc07
to
7b3e595
Compare
* [components] Tri state switch * [components] Support indeterminate state on checkboxes #47 * [components] Changes from PR
* [components] Tri state switch * [components] Support indeterminate state on checkboxes #47 * [components] Changes from PR
* [components] Tri state switch * [components] Support indeterminate state on checkboxes #47 * [components] Changes from PR
Shows that a boolean is
undefined
. Usually shows when creating a new document in studio.There is no support for setting the checkbox/switch back to
undefined
at this point.