Skip to content

Conversation

@ShadeWyrm
Copy link
Contributor

@ShadeWyrm ShadeWyrm commented Oct 2, 2025

A refactor of the formBuilder.tsx to adopt a component model with the final intent being components (eg: TextField, Checkbox, AddressComplete, FileInput, etc...) are fully self contained, and logic is not spread across the application.

This PR only implements the TextField component so that it can be tested heavily, and then a new PR can be span up for other components in parallel.

@ShadeWyrm ShadeWyrm marked this pull request as draft October 2, 2025 17:28
@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2025

@ShadeWyrm ShadeWyrm marked this pull request as ready for review October 3, 2025 13:32
@ShadeWyrm ShadeWyrm changed the title Chore: Replace formBuilder.tsx with Component Model Chore: Replace formBuilder.tsx with Component Model PT1 of Many Oct 3, 2025
? element.properties.validation.required
: false;

const descriptionPerLocale = element.properties[getLocalizedProperty("description", lang)];
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should have helpers for pulling descriptions titles etc... ?

Just thinking about how repetitive this is going to get.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same with the Label, I've just been thinking through how I want to do it in case we need to break a label out of an element in other ways.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went with just making a linked component, but it feels a bit ugly. I'll keep thinking, and if anyone has a better idea.

meta: {
type: FormElementTypes.textField,
},
render({ element, lang }) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we add a toString or renderString value ... for things like the review page / response downloads?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, did we want to make that change for this PR for textField as a proof of concept, or save it for the next one? I was going to break out validation as well.

Copy link
Member

Choose a reason for hiding this comment

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

We can save it for the next one :)

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.

3 participants