-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to set fields in an issue in redux
- Loading branch information
1 parent
4c6ad1a
commit 5068c24
Showing
4 changed files
with
80 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,68 @@ | ||
import React from 'react' | ||
import React, { PureComponent } from 'react' | ||
import { connect } from 'react-redux' | ||
import { changeField } from '../actions' | ||
import { selectDraftIssue } from '../selectors/issues' | ||
import styles from '../css/MeetingTable' | ||
|
||
const MeetingTable = () => ( | ||
<div className={styles.meetingTable}> | ||
<div className={styles.meetingRows}> | ||
<label htmlFor='MettingPoint' className={styles.meetingLabels}> | ||
Meeting point | ||
</label> | ||
<input className='form-control' /> | ||
</div> | ||
<div className={styles.meetingRows}> | ||
<label htmlFor='ShortDesc' className={styles.meetingLabels}> | ||
{' '} | ||
Short Desc{' '} | ||
</label> | ||
<textarea className='form-control' /> | ||
</div> | ||
<div className={styles.meetingRows}> | ||
<label htmlFor='NumVotes' className={styles.meetingLabels}> | ||
{' '} | ||
Num of votes reqd{' '} | ||
</label> | ||
<input /> | ||
</div> | ||
</div> | ||
) | ||
class _MeetingTable extends PureComponent { | ||
onChangeNumVotes = event => { | ||
this.props.changeField('numVotes', event.currentTarget.value) | ||
} | ||
|
||
onChangeDescription = event => { | ||
this.props.changeField('description', event.currentTarget.value) | ||
} | ||
|
||
onChangeLabel = event => { | ||
this.props.changeField('label', event.currentTarget.value) | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className={styles.meetingTable}> | ||
<div className={styles.meetingRows}> | ||
<label htmlFor='ShortDesc' className={styles.meetingLabels}> | ||
{' '} | ||
Issue label{' '} | ||
</label> | ||
<textarea | ||
className='form-control' | ||
value={this.props.draftIssue.get('label')} | ||
onChange={this.onChangeLabel} | ||
/> | ||
</div> | ||
<div className={styles.meetingRows}> | ||
<label htmlFor='MettingPoint' className={styles.meetingLabels}> | ||
Issue description | ||
</label> | ||
<input | ||
className='form-control' | ||
value={this.props.draftIssue.get('description')} | ||
onChange={this.onChangeDescription} | ||
/> | ||
</div> | ||
<div className={styles.meetingRows}> | ||
<label htmlFor='NumVotes' className={styles.meetingLabels}> | ||
{' '} | ||
Num of votes reqd{' '} | ||
</label> | ||
<input | ||
value={this.props.draftIssue.get('numVotes')} | ||
onChange={this.onChangeNumVotes} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
const MeetingTable = connect( | ||
state => ({ | ||
draftIssue: selectDraftIssue(state), | ||
}), | ||
dispatch => ({ | ||
changeField: (field, value) => dispatch(changeField(field, value)), | ||
}) | ||
)(_MeetingTable) | ||
|
||
export default MeetingTable |
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