Skip to content

Commit

Permalink
Add time picker
Browse files Browse the repository at this point in the history
  • Loading branch information
typeoh committed Jul 25, 2017
1 parent cb7279e commit 4640cbf
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 31 deletions.
7 changes: 4 additions & 3 deletions src/itinerary/ItineraryIndex.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ class ItineraryIndex extends Component {
time: time
})
}
setDate(date) {
setDate(date, time) {
this.setState({
date: date
date: date,
time: time
})
console.log('parent set date', date)
}
Expand All @@ -105,7 +106,7 @@ class ItineraryIndex extends Component {
<FavoriteBar favCards={this.state.favCards} add={this.add.bind(this)} />
</div>
<div className="welcome">
<Set setDate={this.setDate.bind(this)} />
<Set setDate={this.setDate.bind(this)}/>
<h3 className="title is-3">{this.state.date.format('LL')}</h3>
</div>
<div className="columns">
Expand Down
23 changes: 12 additions & 11 deletions src/itinerary/Set.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Set extends Component {
constructor(props) {
super(props)
this.state = {
startDate: moment()
startDate: moment(),
};
this.handleChange = this.handleChange.bind(this);
}
Expand All @@ -16,6 +16,9 @@ class Set extends Component {
startDate: date
});
}
handleInput(time) {
console.log(time)
}
toggleActive() {
this.setState({
isActive: !this.state.isActive
Expand Down Expand Up @@ -49,20 +52,18 @@ class Set extends Component {
selected={this.state.startDate}
onChange={this.handleChange}
/>
</section>
<section className="modal-card-foot">
<div className="column">
<div className="control has-text-centered">
<button type="submit" value="submit" className="button" onClick={this.submitDate.bind(this)}>Submit</button>
<div className="column">
<div className="control has-text-centered">
<button type="submit" value="submit" className="button" onClick={this.submitDate.bind(this)}>Submit</button>
</div>
</div>
</div>
</section>
<div>
</div>
<div>
</div>
</div>
</div>
</div>
</div>
);
);
}
}

Expand Down
65 changes: 52 additions & 13 deletions src/itinerary/TimeSet.jsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,63 @@
import React, { Component } from 'react';

class TimeSet extends Component {
constructor(props) {
super(props)
this.state = {
startTime: 9
};
}
render() {
const timeArray = this.props.time;
console.log('time in timeset is', parseInt(this.props.time))
const cardArray = this.props.card
console.log(cardArray)
return (
<div className="has-text-centered">
{
timeArray.map((time) => {
return <div className="time" >
<h6 className="title is-6">{`${time} : 00`}</h6>
</div>;
})
}
<div className="time-input">
<input className="input" type="number" placeholder="9" onKeyDown={(event) => {
if (event.key === 'Enter') {
console.log('new time!!!!!', event.target.value)
}
}} />
<div className="select is-multiple"onClick={(event) => {
if (event.key === 'Enter') {
console.log('new time!!!!!', event.target.value)
}
}}>
<select multiple size="2">
<option value="AM" onClick={(event) => {
if (event.key === 'Enter') {
console.log('new time!!!!!', event.target.value)
}
}}>AM</option>
<option value="PM" onClick={(event) => {
if (event.key === 'Enter') {
console.log('new time!!!!!', event.target.value)
}
}}>PM</option>
</select>
</div>
</div>
);
}
}

export default TimeSet;

// Logic for rendering times based on start time and duration of card
// <div className="has-text-centered">
// {
// timeArray.map((time) => {
// if(time === 9){
// return <div className="time">
// <h6 className="title is-6">{`${time} : 00`}</h6>
// </div>;
// } else {
// return <div className="time" style={{marginTop: time*12 + 'px'}}>
// <h6 className="title is-6">{`${time} : 00`}</h6>
// </div>;
// }
// })
// }
// </div>
// );
// }
// }
// <div className="time has-text-centered">
// <h6 className="title is-6">{this.props.time} : 00</h6>
// </div>
6 changes: 3 additions & 3 deletions src/itinerary/dnd/SortableComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class SortableComponent extends Component {
render() {

const items = this.props.cards;
console.log('items are', items)
const renderedItems = this.state.items.map(card =>
<div className='box'>
<article className='media large'>
Expand All @@ -99,9 +100,8 @@ class SortableComponent extends Component {
<div className="content">
<p>
<strong>{card.title}</strong>
<br className="subtitle"></br>
{card.address}
<br></br><small>{card.duration}</small>
<br></br>
<h6 className="subtitle is-6">{card.description}</h6>
</p>
</div>
</div>
Expand Down
7 changes: 6 additions & 1 deletion styles/_itineraryCard.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.itinerary-container {
margin: 120px 80px;
.image{
.img{
height: 100%;
}
}
.columns{
.morning {
margin-top: 1rem;
Expand All @@ -14,7 +19,7 @@
height:80px;
}
.media-content.large{
height:10rem;
height:10rem;
}
.fa {
color:$green;
Expand Down

0 comments on commit 4640cbf

Please sign in to comment.