-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Form input validation): Begin make basic validations.
- Loading branch information
1 parent
36cc529
commit dc63ad5
Showing
7 changed files
with
376 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,63 @@ | ||
import PropTypes from 'prop-types' | ||
import React, { Component } from 'react' | ||
import React from 'react' | ||
import { Checkbox, ControlLabel, FormGroup } from 'react-bootstrap' | ||
|
||
/** | ||
* User terms of use pane. | ||
*/ | ||
class TermsOfUsePane extends Component { | ||
static propTypes = { | ||
disableCheckTerms: PropTypes.bool, | ||
onUserDataChange: PropTypes.func.isRequired, | ||
userData: PropTypes.object.isRequired | ||
} | ||
|
||
_handleCheckHistoryChange = e => { | ||
const { onUserDataChange } = this.props | ||
onUserDataChange({ storeTripHistory: e.target.checked }) | ||
} | ||
|
||
_handleCheckTermsChange = e => { | ||
const { onUserDataChange } = this.props | ||
onUserDataChange({ hasConsentedToTerms: e.target.checked }) | ||
} | ||
|
||
render () { | ||
const { disableCheckTerms, userData } = this.props | ||
const { | ||
hasConsentedToTerms, | ||
storeTripHistory | ||
} = userData | ||
|
||
return ( | ||
<div> | ||
<ControlLabel>You must agree to the terms of service to continue.</ControlLabel> | ||
|
||
<FormGroup> | ||
<Checkbox | ||
checked={hasConsentedToTerms} | ||
disabled={disableCheckTerms} | ||
onChange={disableCheckTerms ? null : this._handleCheckTermsChange} | ||
> | ||
{/* TODO: Implement the link */} | ||
const TermsOfUsePane = ({ | ||
disableCheckTerms, | ||
handleBlur, | ||
handleChange, | ||
values: userData | ||
}) => { | ||
const { | ||
hasConsentedToTerms, | ||
storeTripHistory | ||
} = userData | ||
|
||
return ( | ||
<div> | ||
<ControlLabel>You must agree to the terms of service to continue.</ControlLabel> | ||
|
||
<FormGroup> | ||
<Checkbox | ||
checked={hasConsentedToTerms} | ||
disabled={disableCheckTerms} | ||
name='hasConsentedToTerms' | ||
onBlur={disableCheckTerms ? null : handleBlur} | ||
onChange={disableCheckTerms ? null : handleChange} | ||
> | ||
{/* TODO: Implement the link */} | ||
I have read and consent to the <a href='/#/terms-of-service'>Terms of Service</a> for using the Trip Planner. | ||
</Checkbox> | ||
</FormGroup> | ||
|
||
<FormGroup> | ||
<Checkbox | ||
checked={storeTripHistory} | ||
onChange={this._handleCheckHistoryChange} | ||
> | ||
{/* TODO: Implement the link */} | ||
</Checkbox> | ||
</FormGroup> | ||
|
||
<FormGroup> | ||
<Checkbox | ||
checked={storeTripHistory} | ||
name='storeTripHistory' | ||
onBlur={handleBlur} | ||
onChange={handleChange} | ||
> | ||
{/* TODO: Implement the link */} | ||
Optional: I consent to the Trip Planner storing my historical planned trips in order to | ||
improve transit services in my area. <a href='/#/terms-of-storage'>More info...</a> | ||
</Checkbox> | ||
</FormGroup> | ||
</div> | ||
) | ||
} | ||
</Checkbox> | ||
</FormGroup> | ||
</div> | ||
) | ||
} | ||
|
||
TermsOfUsePane.propTypes = { | ||
disableCheckTerms: PropTypes.bool, | ||
handleBlur: PropTypes.func.isRequired, | ||
handleChange: PropTypes.func.isRequired, | ||
values: PropTypes.object.isRequired | ||
} | ||
|
||
TermsOfUsePane.defaultProps = { | ||
disableCheckTerms: false | ||
} | ||
|
||
export default TermsOfUsePane |
Oops, something went wrong.