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

Let FormControl accept any input #1968

Merged
merged 10 commits into from
Mar 16, 2022
Merged

Let FormControl accept any input #1968

merged 10 commits into from
Mar 16, 2022

Conversation

mperrotti
Copy link
Contributor

Instead of rendering unexpected* FormControl children before the other children, we render them in the same spot we'd normally render an input.

* any component that is not a Primer input component or not in the FormControl namespace

Closes #1964

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@mperrotti mperrotti requested review from a team and pksjce March 16, 2022 14:12
@changeset-bot
Copy link

changeset-bot bot commented Mar 16, 2022

🦋 Changeset detected

Latest commit: aa500e9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Mar 16, 2022

size-limit report 📦

Path Size
dist/browser.esm.js 63.19 KB (-0.34% 🔽)
dist/browser.umd.js 63.54 KB (-0.34% 🔽)

Copy link
Contributor

@dusave dusave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes requested in docs, the code looks good!

Approving in advance :)

docs/content/FormControl.mdx Show resolved Hide resolved
docs/content/FormControl.mdx Show resolved Hide resolved
docs/content/FormControl.mdx Show resolved Hide resolved
docs/content/FormControl.mdx Outdated Show resolved Hide resolved
docs/content/FormControl.mdx Outdated Show resolved Hide resolved
src/FormControl/_FormControlCaption.tsx Show resolved Hide resolved
Co-authored-by: Siddharth Kshetrapal <siddharthkp@github.com>
docs/content/FormControl.mdx Show resolved Hide resolved
docs/content/FormControl.mdx Outdated Show resolved Hide resolved
@@ -183,13 +175,8 @@ const FormControl = React.forwardRef<HTMLDivElement, FormControlProps>(
display="flex"
flexDirection="column"
width="100%"
sx={{...(isLabelHidden ? {'> *:not(label) + *': {marginTop: 2}} : {'> * + *': {marginTop: 2}}), ...sx}}
sx={{...(isLabelHidden ? {'> *:not(label) + *': {marginTop: 1}} : {'> * + *': {marginTop: 1}}), ...sx}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has nothing to do with accepting different input components.
I looked at this with fresh eyes and thought the elements were spaced too far apart.

@mperrotti mperrotti merged commit 1b01485 into main Mar 16, 2022
@mperrotti mperrotti deleted the mp/form-control-any-input branch March 16, 2022 20:40
@primer-css primer-css mentioned this pull request Mar 16, 2022
pksjce pushed a commit that referenced this pull request Mar 17, 2022
* renders any non-FormControl components passed into FormControl in the spot we'd normally render a Primer input component

* adds changeset

* appease the linter

* Update docs/content/FormControl.mdx

Co-authored-by: Siddharth Kshetrapal <siddharthkp@github.com>

* addresses PR feedback

Co-authored-by: Siddharth Kshetrapal <siddharthkp@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FormControl does not support custom components
3 participants