cliff-effects icon indicating copy to clipboard operation
cliff-effects copied to clipboard

Move results out of the `<Form>` they're in now

Open knod opened this issue 7 years ago • 8 comments

Not sure how complicated this will get, or even if we should do it. The results aren't really a form semantically, though they do have interactive elements. On the other hand, if we do this, all my plans for abstracting the duplication happening in the instantiation of the sections will be blown away! Well, some of it anyway. It may have other consequences too - the <Form> is currently being used as the container for every section and I'm not sure how much of the heavy lifting it's doing. It may be really easy, though, and beginner friendly...

Thoughts?

knod avatar Aug 26 '18 12:08 knod

OK, so although I don't think it'll make any difference in appearance, I'm onboard with the idea of this for semantics. The first part of the predictions page where you enter future income is still a form, so I think that should be in a <Form>, but maybe the rest shouldn't.

Currently we have a <FormPartsContainer> nested inside a <Form> on each page. Based on some quick experimentation it looks like nothing breaks if we reverse this nesting, putting the <FormPartsContainer> on the outside. (This has to enclose everything on the page since it wraps the nav buttons around it.) So we could reverse that nesting on each page, and then exclude the warning message and tabbed graphs from the <Form> on the results page. It looks like this also doesn't mess up the styles.

Then, I'd guess, we'd want to rename <FormPartsContainer> to something more general.

ethanbb avatar Aug 26 '18 22:08 ethanbb

Nice, thanks for trying that out! How about <ToolSection>, <Form/ToolPage> (since they will be pages not too long from now)? Or... <CESection>

knod avatar Aug 27 '18 22:08 knod

Not sure exactly what renamings you're suggesting, but I think you should go with whatever seems right to you, at least to make the PR.

ethanbb avatar Aug 27 '18 22:08 ethanbb

I'm talking about renaming FormPartsContainer. Of the options, I'm partial to FormPage right now, though I'm not a huge fan of any of them.

knod avatar Aug 27 '18 23:08 knod

Hmm, this would make the abstraction of form sections more difficult - I was going to put the repeated code into <VisitPage>, containing each section's content...

knod avatar Sep 15 '18 19:09 knod

So you're saying you were planning on pulling both the <Form> and <FormPartsContainer> as they are now out into <VisitPage>? Just to make sure I understand.

ethanbb avatar Sep 16 '18 06:09 ethanbb

Yeah, that was my plan. Until now... though we could possibly use a Surrounder...?

knod avatar Sep 17 '18 14:09 knod

Not sure how exactly yet.

knod avatar Sep 17 '18 14:09 knod