-
Notifications
You must be signed in to change notification settings - Fork 31
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
Modularized components #798
Conversation
…with PropsFromGenericComponent, and making sure typescript knows that: - Summary components cannot be inside Group components (now using ComponentInGroup for this type) - Summary components cannot be rendered directly using GenericComponent.tsx (now using RenderableGenericComponent for this) - Lots more various cleanup to make typings work
…pecific logic to where the code should belong (in the layout component folder)
…r not. Cleaning up some splat-properties and passing componentValidations to everyone (each component can decide on their own if they want to use the validations).
…t() into LayoutComponent.ts
What do you think, @bjosttveit? I know you had thoughts about how to solve this. Did you imagine it differently, or were we on the same track? |
I guess my thoughts were mostly idealistic and more relevant to a major release by having component classes do much more than having a render function (like validation logic, having some sort of |
Ah, yup, sounds like we think much in the same way, then.. 😅 I think smaller steps at each point in time will be easier to implement (and test), so I also think this is just the beginning. I thought about starting the refactor to include I'm also having (admittedly half-baked) thoughts about running I'll open up this one for review, so that we can tackle each puzzle piece at a time (so not closing #377 quite yet). |
Sounds good! So I guess we are on the same page, except you actually have a plan to get there, I had no idea where to begin 😅 |
# Conflicts: # src/layout/GenericComponent.tsx
…that change arrived now when merging from main)
…(that was also read in checkboxes, but no longer used there either). It's not passed by GenericComponent, so I suspected this not to be in use - and validation messages never arrives here in any way I can figure out how to test either.
SonarCloud Quality Gate failed. |
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.
Description
Started modularizing layout components. In other words, a new
LayoutComponent
class has been added (which every layout component now has to implement). It is the common 'tool box' used byGenericComponent.tsx
and serves as a place where every peculiarity of each layout component implementation should be implemented.This is the start, and builds a framework we can extend further. As discussed in the comments under,
getDisplayFormData
is probably the next thing to start working on moving into this class.As this change is only about moving code around, I'm relying on our automatic tests to catch any bugs introduced, and so I haven't really tested this change myself. It turned out that not all components expected all the same properties as they get from
GenericComponent.tsx
, so I had to clean some of them up for this to work. For example,CheckboxContainerComponent
could render validation messages if givenvalidationMessages
, but that doesn't ever seem to happen (so I removed that part).Related Issue(s)
Verification
src/layout/layout.d.ts
andlayout.schema.v1.json
, and these are all backwards-compatible