-
Notifications
You must be signed in to change notification settings - Fork 1
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
✨ #19 - Basic Form.io conditionals. #28
Conversation
export interface IRenderComponentProps { | ||
component: IColumnComponent | IRendererComponent; | ||
component: IRenderable; | ||
form: IFormioForm; |
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.
I'm wondering if it wouldn't make more sense to provide the entire form via RenderContext = React.createContext({form: {}})
It's something that will affect other aspects (I think) so it has more of a "global" and implicit nature. It would also avoid prop-drilling through utility components and have to be provided only once in the RenderForm
, while we could add a storybook decorator to wrap atomic components with 🤔
Mostly thinking out loud here!
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.
Yeah I really don't like context for that global nature. Pretty much only for application state and only if props passing and composition seem to be unpractical IMO.
Especially in the domain where we don't want to rely on internals due to the use case it's also an issue when stuff is available only in context and not through the proper interfaces.
components?: IRenderable[]; | ||
clearOnHide?: boolean; | ||
columns?: IRenderable[]; |
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.
technically more correct would be (typescript code untested, so probably has some mistakes):
interface Columns {
type: 'columns',
columns: IRenderable[]; // or even a specific Column type...
}
type ComponentContainer = ComponentSchema & {
type: 'fieldset' | 'editgrid'; // I think that's all we support at the moment
components: IRenderable[];
}
type IRenderable = ComponentSchema | ComponentContainer | Columns;
The union here is especially powerful for implementation/decision branches that you can isolate.
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.
I'm already planning on refactoring this further in #43 due to needing to implement stuff which is renderable but not explcitly derived from the schema as a component, this is still a moving thing.
- Move fixture to story. - Remove selector option in test.
f6b4280
to
210bae7
Compare
Closes #19