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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Form.Check.Label
spacing
#5983
Merged
kyletsang
merged 9 commits into
react-bootstrap:master
from
TyMick:fix-form-check-label-spacing
Nov 29, 2021
Merged
Fix Form.Check.Label
spacing
#5983
kyletsang
merged 9 commits into
react-bootstrap:master
from
TyMick:fix-form-check-label-spacing
Nov 29, 2021
Commits on Oct 22, 2021
-
Currently, when using a `Form.Check.Label` component to customize `Form.Check` rendering, there will be no space between the checkbox and the label. This is because `Form.Check` is currently relying on the presence of a `label` prop to apply the `form-check` class name to the wrapping `<div>`, because checkboxes without labels [don't need the wrapping element to have the `form-check` class name][1]. This commit adds a utility to check whether an element has a child of a certain type. It then uses that utility to check if a `Form.Check` element has a `Form.Check.Label` child and takes that into account when determining whether the checkbox has a label. Adding a special property (currently called `typeName`, but that can certainly change) to components for this utility is necessary because React minifies the `displayName` property in production. [1]: react-bootstrap#5938 (comment)
Configuration menu - View commit details
-
Copy full SHA for 156b16e - Browse repository at this point
Copy the full SHA 156b16eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4085009 - Browse repository at this point
Copy the full SHA 4085009View commit details -
Support mixing auto and custom child components
Currently, `Form.Check` doesn't allow users to use a custom `Form.Check.Input` with a label generated by the `label` prop (and requires that a custom `Form.Check.Input` be used if a custom `Form.Check.Label` is also used) because the presence of _any_ children in `Form.Check` prevents automatic inputs and labels (and feedback) from generating. This approach allows mixing and matching by extracting any custom input, label, and feedback components from `Form.Check`'s `children` prop, then separately for each, using the custom component if provided or an automatic component otherwise.
Configuration menu - View commit details
-
Copy full SHA for 3b7a225 - Browse repository at this point
Copy the full SHA 3b7a225View commit details
Commits on Oct 23, 2021
-
The `type` property of React elements have reference equality with matching imported component variables (`JSXElementConstructor` objects, to be precise)! For some reason I was not expecting that, but it makes sense to me now, since these constructor objects are being imported from a singular source, so there's no reason React would create multiple instances of them. So `child.type === type` all we need to check in `getChildOfType`; the `typeName` prop I added earlier is not at all needed.
Configuration menu - View commit details
-
Copy full SHA for c86d65d - Browse repository at this point
Copy the full SHA c86d65dView commit details -
Add scripts for testing production build of docs
Just as a convenience. I can revert this commit if these scripts aren't desired.
Configuration menu - View commit details
-
Copy full SHA for 5343b0a - Browse repository at this point
Copy the full SHA 5343b0aView commit details
Commits on Nov 6, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 0754b49 - Browse repository at this point
Copy the full SHA 0754b49View commit details
Commits on Nov 9, 2021
-
Configuration menu - View commit details
-
Copy full SHA for f0d8e9f - Browse repository at this point
Copy the full SHA f0d8e9fView commit details
Commits on Nov 29, 2021
-
Revert empty
.husky/pre-commit
changeNo idea how that got into 0754b49.
Configuration menu - View commit details
-
Copy full SHA for 101e286 - Browse repository at this point
Copy the full SHA 101e286View commit details -
Revert "Add scripts for testing production build of docs"
This reverts commit 5343b0a.
Configuration menu - View commit details
-
Copy full SHA for 1d85fb3 - Browse repository at this point
Copy the full SHA 1d85fb3View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.