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

feat: Add Bootstrap 4 Theme support #1938

Merged
merged 63 commits into from
Aug 4, 2020

Conversation

Xtremilicious
Copy link
Collaborator

Reasons for making this change

To add Bootstrap 4 theme support for react-jsonschema-form as a task for the MLH Fellowship 2020.

Fix #1455

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests
    • I've updated docs if needed
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

anikethsaha and others added 30 commits July 21, 2020 12:31
@epicfaace
Copy link
Member

Some comments after looking through the playground:

I think the description field is too big here ("Simple" tab):

image

Any idea why the "nested" example has cut off text?

image

"nested" example -- can you make sure the buttons ("+" and "-") have a consistent size?

image

"nested" example -- the "Done?" is supposed to be a checkbox, but it's rendering as a big title:

image

"nested" example -- apparently [object Object] are being passed in for the uiSchema and registry HTML attributes for the <input> tag. Can you remove them?

image

"widgets" example -- the read-only fields should have the readonly attribute set, not the disabled attribute.

image

"simple" example -- whenever I type anything in a textbox, I get this error in the console:

image

Validation - the validation doesn't seem to look quite like what default validation in bootstrap looks like. Can you use this to render inline validation errors instead: https://react-bootstrap.github.io/components/forms/#forms-validation-libraries

image

Error List - any idea why the bottom left and bottom right corners aren't connected? Also, can you add a bit more margin below the error list (like how it looks like for the bootstrap 3 form)?

image

"Widgets" tab - I am not able to click on "No" to change the value for the radio button.

image

"Files" tab - can you change the file input to use Bootstrap's file input (https://getbootstrap.com/docs/4.0/components/forms/#file-browser)?

image

"Alternatives" tab - I can't select anything in the multiselect widget:

image

"Additional Properties" tab - can you implement the additional properties functionality here?

image

"Nested" tab - can you make the help text grey with the text-muted class as described in the Bootstrap docs? Additionally,

image

@anikethsaha
Copy link
Collaborator

@epicfaace We have updated the tests and applied suggestions.
CI tests are passing. Not sure about the netlify thing.

@epicfaace
Copy link
Member

@anikethsaha can you merge the latest master into this branch? That should fix the netlify issue.

@Xtremilicious
Copy link
Collaborator Author

Xtremilicious commented Jul 30, 2020

@anikethsaha can you merge the latest master into this branch? That should fix the netlify issue.

@epicfaace I did the merge, still failing.

@anikethsaha
Copy link
Collaborator

@epicfaace it seems the build is still failing.

From the logs, it looks like it is simply running the build command instead of installing the dependencies I think.

let us know if anything else is required to fix from our end

Copy link
Member

@epicfaace epicfaace left a comment

Choose a reason for hiding this comment

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

Looks good! I wouldn't worry about the Netlify errors; it's probably a problem on their end.

A small minor changes, and this PR should be good to merge. We don't need the file input and additional properties features in order to merge this initial PR in, so I've made separate issues for them (#1962 and #1963). If you're able to work on them, that would be great!


const DescriptionField = ({ description }: Partial<FieldProps>) => {
if (description) {
return <div><h6 className="mb-5">{description}</h6></div>;
Copy link
Member

Choose a reason for hiding this comment

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

We don't want descriptions to be in bold

Suggested change
return <div><h6 className="mb-5">{description}</h6></div>;
return <div><div className="mb-5">{description}</div></div>;

{errors.map((error, i: number) => {
return (
<ListGroup.Item key={i} className="border-0">
<small>{error.stack}</small>
Copy link
Member

Choose a reason for hiding this comment

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

Let's use regular-sized text for ErrorList

Suggested change
<small>{error.stack}</small>
<span>{error.stack}</span>

import { ErrorListProps } from "@rjsf/core";

const ErrorList = ({ errors }: ErrorListProps) => (
<Card border="danger" className="mb-2">
Copy link
Member

Choose a reason for hiding this comment

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

Need more margin between this and the form title

Suggested change
<Card border="danger" className="mb-2">
<Card border="danger" className="mb-4">

@anikethsaha
Copy link
Collaborator

@epicfaace I have updated the code with your changes.

Let us know if there is anything else required.

@epicfaace epicfaace merged commit b07cb88 into rjsf-team:master Aug 4, 2020
@nicmendoza
Copy link

nicmendoza commented Aug 4, 2020

I'm super excited to try this out -- are you planning on updating the documentation so it references this theme? I'm not clear how to actually use it. It appears, based on the other themes, that I need to install @rjsf/bootstrap-4, which doesn't exist.

Edit: Ok, I found the nested documentation for the package. The @rjsf/bootstrap-4 package appears to not be in the npm registry.

@epicfaace
Copy link
Member

epicfaace commented Aug 4, 2020

Yeah, it isn't released to npm yet -- it will be released on the next release.

@anikethsaha @Xtremilicious could you make a PR that updates the theme list table on the documentation to add this theme?

@anikethsaha
Copy link
Collaborator

@epicfaace
Copy link
Member

Xtremilicious added a commit to MLH-Fellowship/react-jsonschema-form that referenced this pull request Aug 7, 2020
feat: Add Bootstrap 4 Theme support (rjsf-team#1938)
@epicfaace
Copy link
Member

@rjsf/bootstrap-4 has just been published to npm with version 2.3.0. Thanks for your patience!

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.

Support bootstrap 4
5 participants