-
Notifications
You must be signed in to change notification settings - Fork 104
feat(Form): initial Implementation #242
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
Conversation
…lytical-table-dnd
…use of a standard style added; custom dnd hook added
… into feat/analytical-table-dnd
… with absolute layout BREAKING CHANGE: Update `react-table` to `7.0.0-rc.23`
… into feat/form-component
Deploy preview for ui5-webcomponents-react ready! Built with commit 211ac8f https://deploy-preview-242--ui5-webcomponents-react.netlify.com |
Codecov Report
@@ Coverage Diff @@
## master #242 +/- ##
==========================================
- Coverage 72.53% 72.48% -0.05%
==========================================
Files 156 162 +6
Lines 3466 3558 +92
Branches 605 618 +13
==========================================
+ Hits 2514 2579 +65
- Misses 744 769 +25
- Partials 208 210 +2
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.
Couldn´t find any bugs. It works as expected!
Just a couple of things:
- You extracted your styles into a jss file, but you don´t actually use jss. It would be cleaner to either use jss or create the styles you need directly in your component with stable references.
- You modified the Grid component and added a new event. You should be able to get the size changes with already existing apis (see comment in grid file)
- Each FormItem reacts separately to viewport changes. I think it would be more efficient (and you would need less code) to only subscribe to viewport changes with the Form component and pass that information down to its children.
- I think the logic to assign separate FormItems to a synthetic FormGroup can be simplified.
- Could you please create lib exports for Form, FormItem and FormGroup? Have a look at
main/src/lib
as a reference. Afterwards, could you please execute the scriptmain/scripts/create-library-export.js
?
@@ -0,0 +1,5 @@ | |||
import React from 'react'; | |||
|
|||
const CurrentRange = React.createContext(null); |
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.
We should delete this file.
<FlexBox | ||
justifyContent={FlexBoxJustifyContent.Start} | ||
alignItems={FlexBoxAlignItems.End} | ||
fitContainer={true} |
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.
should be a tslint error. You should omit the ={true}
part.
import { TitleLevel } from '@ui5/webcomponents-react/lib/TitleLevel'; | ||
import { styles } from './Form.jss'; | ||
import { createUseStyles } from 'react-jss'; | ||
import { useViewportRange } from '@ui5/webcomponents-react-base/src/hooks/useViewportRange'; |
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.
you should add a lib export for useViewportRange
and import from there. see e.g. lib/Device
.
import { styles } from './Grid.jss'; | ||
import { useViewportRange } from '@ui5/webcomponents-react-base/src/hooks/useViewportRange'; |
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.
see comment above. You should import from @ui5/webcomponents-react-base/lib/useViewportRange
import notes from './Form.md'; | ||
import { FormItem } from './FormItem'; | ||
import { FormGroup } from './FormGroup'; | ||
import { CheckBox, Input, InputType, Option, Select } from '../..'; |
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 is still not correct. Please import each of those components separately. e.g.
import { CheckBox } from '@ui5/webcomponents-react/lib/CheckBox';
import { Label } from '@ui5/webcomponents-react/lib/Label'; | ||
import { styles } from '../Form.jss'; | ||
import { createUseStyles } from 'react-jss'; | ||
import { CurrentRange } from '../index'; |
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.
Ahhh. I know we talked about this but I now realize that we have a cyclic dependency if we do it this way.... sorry!
Form imports FormItem and FormItem imports Form. Thats not a good idea. Could we put the CurrentRangeContext in a separate file, please?
Thank you for your contribution! 👏
To get it merged faster, kindly review the checklist below:
Pull Request Checklist