-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
added checkbox option for BoolField for antd #348
Conversation
Codecov Report
@@ Coverage Diff @@
## master #348 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 156 156
Lines 1305 1305
=====================================
Hits 1305 1305
Continue to review full report at Codecov.
|
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.
Thank you very much, especially for adding tests!
@@ -1,83 +1,155 @@ | |||
import React from 'react'; | |||
import Switch from 'antd/lib/switch'; | |||
import Checkbox from 'antd/lib/checkbox'; | |||
import {mount} from 'enzyme'; |
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.
These should be aligned.
@@ -1,26 +1,38 @@ | |||
import Icon from 'antd/lib/icon'; | |||
import React from 'react'; | |||
import Switch from 'antd/lib/switch'; | |||
import Checkbox from 'antd/lib/checkbox'; | |||
import connectField from 'uniforms/connectField'; | |||
import filterDOMProps from 'uniforms/filterDOMProps'; |
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.
These should stay in order.
onChange={() => props.onChange(!props.value)} | ||
ref={props.inputRef} | ||
{...filterDOMProps(props)} | ||
/> |
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.
How about React.createElement(props.checkbox ? Checkbox : Switch, {...})
? It'll reduce this duplicated code.
@@ -2,6 +2,7 @@ const unwantedProps = [ | |||
// These props are provided by BaseField | |||
'changed', | |||
'changedMap', | |||
'checkbox', |
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.
These are global, so it's a breaking change. I'd rather go with destructuring props in BoolField
- it won't be needed then.
Thanks for feedback, learning something new every day. |
PR adds ability to create an antd
Checkbox
with uniformsBoolField
instead of just the antdSwitch
.Usage