Skip to content
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

add manual address entry to letter form #1775

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Ceshion
Copy link
Collaborator

@Ceshion Ceshion commented Jul 3, 2020

This PR adds a generic arbitrary-length list component, used in the letter form to allow users to input addresses that are not populated automatically from the Civic API.

Closes #1717

@Ceshion Ceshion requested a review from blackmad July 11, 2020 14:10
Copy link
Contributor

@blackmad blackmad left a comment

Choose a reason for hiding this comment

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

all looks good. have some naming suggestions that I think would be easier to read.

addText: string | ((listItems: Array<TModel>) => string);
modelFactory: () => TModel;
updateModel: (value: Array<TModel>) => void;
eachRender: (updateModel: (value: TModel) => void) => JSX.Element;
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe "renderChild" or "renderEntry" or "renderListEntry"?

Copy link
Contributor

Choose a reason for hiding this comment

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

updateModel => onItemUpdated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think renderListItem and onListItemUpdated to keep consistent with the rest of it

export interface DynamicListProps<TModel> {
addText: string | ((listItems: Array<TModel>) => string);
modelFactory: () => TModel;
updateModel: (value: Array<TModel>) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

onItemsUpdated? onListItemsUpdated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This, I like- it has the potential to be used for more than just updating the model, and I will include it in a new commit 😊

@@ -0,0 +1,6 @@
export interface DynamicListProps<TModel> {
addText: string | ((listItems: Array<TModel>) => string);
modelFactory: () => TModel;
Copy link
Contributor

Choose a reason for hiding this comment

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

emptyModelFactory? defaultModelFactory? createEmptyModel?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not sure those names would be appropriate, since the consumer could definitely create a filled or partially-filled model through a closure, and there would not be anything non-default that seems like it would call for using "default". Is there something you're thinking of that I'm missing?


type AddressInputProps = {
/** callback function for every time the address is updated */
updateParent: (a: LobAddress) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

onAddressUpdated?

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.

Manual physical mail address input
2 participants