Client - add first day of week in user profile - #23

This commit is contained in:
Sam 2019-08-31 16:48:29 +02:00
parent b00b48e138
commit a797568b2a
2 changed files with 20 additions and 1 deletions

View File

@ -46,6 +46,7 @@ function Profile({ message, onDeletePicture, onUploadPicture, user }) {
<p>Location: {user.location}</p> <p>Location: {user.location}</p>
<p>Bio: {user.bio}</p> <p>Bio: {user.bio}</p>
<p>Time zone: {user.timezone}</p> <p>Time zone: {user.timezone}</p>
<p>First day of week: {user.weekm ? 'Monday' : 'Sunday'}</p>
</div> </div>
<div className="col-md-4"> <div className="col-md-4">
{user.picture === true && ( {user.picture === true && (

View File

@ -40,7 +40,11 @@ class ProfileEdit extends React.Component {
handleFormChange(e) { handleFormChange(e) {
const { formData } = this.state const { formData } = this.state
if (e.target.name === 'weekm') {
formData.weekm = e.target.value === 'Monday'
} else {
formData[e.target.name] = e.target.value formData[e.target.name] = e.target.value
}
this.setState(formData) this.setState(formData)
} }
@ -195,6 +199,20 @@ class ProfileEdit extends React.Component {
/> />
</label> </label>
</div> </div>
<div className="form-group">
<label>
First day of week:
<select
name="weekm"
className="form-control input-lg"
value={formData.weekm ? 'Monday' : 'Sunday'}
onChange={e => this.handleFormChange(e)}
>
<option value="Sunday">Sunday</option>
<option value="Monday">Monday</option>
</select>
</label>
</div>
<input <input
type="submit" type="submit"
className="btn btn-primary btn-lg btn-block" className="btn btn-primary btn-lg btn-block"