Skip to content

Vanguyen/dev - #7

Open
vadnguyen wants to merge 25 commits into
masterfrom
vanguyen/dev
Open

Vanguyen/dev#7
vadnguyen wants to merge 25 commits into
masterfrom
vanguyen/dev

Conversation

@vadnguyen

Copy link
Copy Markdown
Collaborator

Adding in the FormTemplateContainer. Updated some of the field control components used in the prebaked/default Form templates. Only NameForm and AddressForm for now.

@n8mellis n8mellis left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looking good! A few comments and questions included inline.

Comment thread lib/components/Dropdown.jsx Outdated
value={this.state.value}
onChange={this._handleChange.bind(this)} >
{emptyPlaceholder}
{options}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I like what you did here, but we should probably use either the options data or the children, not both. It would be unclear what the behavior should be for supporting both. My first thought is that having children should trump supplying options data. Thoughts?

Comment thread lib/components/Form.jsx Outdated
* This component returns a <form> with legend.
*
* Required props:
* - legend: string. sets the form legend

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can the legend ever be more complex than a simple string?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure...there could be situations where it could be a variable that is customized? Like a Name? Or I am not understanding the question...

Comment thread lib/components/Form.jsx Outdated
return (
<div>
<form className="usa-form">
<fieldset className="usa-fieldset-inputs usa-sans">

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'm not sure we always want a top-level fieldset. Fieldsets should be used to group related form elements together so having a form-global one doesn't make a lot of sense. Thoughts?

Comment thread lib/components/NameForm.jsx Outdated
<Form
legend="Name"
>
<TextInput

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Per my comment earlier, I would recommend that we put the fieldset and legend inside this component, not Form. I'm also thinking that we might want to just return a fieldset as the top level rather than a form so that we can mix these fields in to a pre-existing form. In that case we'd probably want to name this NameFields or something like that. Thoughts? @mstanaland thoughts?

Comment thread lib/components/TextInput.jsx Outdated
* - errorMessage: string. If present triggers the error state and displays the error message
* - isValid: bool. If true, sets isValid state - i.e. green border
* - allowedChars: Validator object. If present, user can only type characters that match the given test
* - inputClass: string. If present, adds an custom class to field, for UI specific targeting

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can we re-use the className prop that is already supported? If we don't need to make people learn a new prop name, then we shouldn't.

@vadnguyen vadnguyen self-assigned this Mar 3, 2017
@vadnguyen

vadnguyen commented Mar 7, 2017

Copy link
Copy Markdown
Collaborator Author

@n8mellis Required Fields: I'm not sure that there should be inconsistency between labeling a required field for the Name form and the Address form, see documentation under Address form:
Only label the optional inputs. Users can infer that all the others are required.

Comment thread lib/components/PrimaryButton.jsx Outdated

PrimaryButton.propTypes = {
disabled: React.PropTypes.bool,
onClick: React.PropTypes.function,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@n8mellis this was giving an error in console:
Failed prop type: PrimaryButton: prop type onClick is invalid; it must be a function, usually from React.PropTypes. in PrimaryButton (created by SignInForm)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A function prop type is denoted with func: onClick: React.PropTypes.func,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I had updated to "PropTypes.func" and it still gave me an error. Found out it was a result of another error. SO, fixed all that 👍

</fieldset>
</Form>
)
export default class SignInForm extends React.Component { /**

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@n8mellis should this be broken down in to smaller components, or should it be handled as a part of SignInForm component - button texts, show/hide password toggle?

@vadnguyen

Copy link
Copy Markdown
Collaborator Author

@n8mellis completed the templates - updated to latest docs structure (thanks @mstanaland !) please review

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