-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleaned up home page, added find page
- Loading branch information
Showing
23 changed files
with
465 additions
and
82 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
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
height: 50px; | ||
|
||
#logo { | ||
width: 100px; | ||
width: 150px; | ||
padding: 20px 0 0 40px; | ||
} | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import React from "react"; | ||
import { get } from "lodash"; | ||
import { push } from "react-router-redux"; | ||
import { bindActionCreators } from "redux"; | ||
import { connect } from "react-redux"; | ||
import { Input } from "react-materialize"; | ||
import Button from "../Button"; | ||
import SelectInput from "../SelectInput"; | ||
import cities from "../../config/cities"; | ||
|
||
// used for calendar component | ||
import "materialize-css/dist/css/materialize.min.css"; | ||
import "materialize-css/dist/js/materialize.min.js"; | ||
|
||
class Search extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
source: "", | ||
destination: "", | ||
date: "" // this is stored as a 13 digit epoch time | ||
}; | ||
} | ||
|
||
handleChange = (e, input) => { | ||
this.setState({ | ||
[input]: get(e, "value", "") | ||
}); | ||
}; | ||
|
||
onFind = () => { | ||
// TODO: Check if all fields are complete and mabye push /rides/<params> ? | ||
this.props.changePage("/rides"); | ||
// TODO: need to dispatch a fetch to the api here to get list of rides | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div className="search"> | ||
<h3>Find a ride</h3> | ||
<h5> | ||
Currently we only support UCLA as an origin. Check back later for more | ||
locations! | ||
</h5> | ||
|
||
<SelectInput | ||
materialIcon="person_pin" | ||
label="Origin" | ||
value={this.state.source} | ||
placeholder="Choose your origin" | ||
onChange={e => this.handleChange(e, "source")} | ||
options={cities} | ||
/> | ||
|
||
<SelectInput | ||
materialIcon="pin_drop" | ||
label="Destination" | ||
value={this.state.destination} | ||
placeholder="Choose your destination" | ||
onChange={e => this.handleChange(e, "destination")} | ||
options={cities} | ||
/> | ||
|
||
<div className="input"> | ||
<i className="material-icons prefix">date_range</i> | ||
<Input | ||
placeholder="Date" | ||
type="date" | ||
onChange={e => this.handleChange({ value: e.timeStamp }, "date")} | ||
/> | ||
</div> | ||
|
||
<Button | ||
label="Find" | ||
color="primary" | ||
materialIcon="search" | ||
onClick={this.onFind} | ||
/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
const mapDispatchToProps = dispatch => | ||
bindActionCreators( | ||
{ | ||
changePage: link => push(link) | ||
}, | ||
dispatch | ||
); | ||
|
||
export default connect(null, mapDispatchToProps)(Search); |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.search { | ||
margin: 0 auto; | ||
margin-top: 20px; | ||
text-align: left; | ||
width: 600px; | ||
|
||
@media only screen and (max-width: 600px) { | ||
width: 300px; | ||
} | ||
|
||
.input-field { | ||
margin-top: 0; | ||
padding-left: 20px; | ||
width: 100%; | ||
|
||
input::placeholder { | ||
color: gray; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from "react"; | ||
import Select from "react-select"; | ||
|
||
const SelectInput = props => ( | ||
<div className="input"> | ||
<i className="material-icons prefix">{props.materialIcon}</i> | ||
<div className="field"> | ||
<label>{props.label}</label> | ||
<Select | ||
value={props.value} | ||
placeholder={props.placeholder} | ||
onChange={props.onChange} | ||
options={props.options} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default SelectInput; |
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.input { | ||
padding: 15px 0; | ||
display: flex; | ||
|
||
label { | ||
color: #bbb; | ||
font-size: 12px; | ||
} | ||
|
||
.field { | ||
width: 100%; | ||
padding-left: 20px; | ||
} | ||
|
||
i { | ||
vertical-align: middle; | ||
font-size: 2rem; | ||
line-height: 2em; | ||
} | ||
|
||
/* Custom CSS for React Select Component */ | ||
|
||
.Select-placeholder, .Select-input, .Select-value { | ||
color: black; | ||
font-size: 15px; | ||
padding-left: 0 !important; | ||
line-height: 40px !important; | ||
|
||
input { | ||
padding: 0; | ||
} | ||
} | ||
|
||
.Select-control { | ||
border: none; | ||
border-bottom: 1px solid #ccc; | ||
border-radius: 0; | ||
} | ||
|
||
.Select.is-focused:not(.is-open) > .Select-control { | ||
box-shadow: none; | ||
border-color: #aaa; | ||
} | ||
|
||
.Select-menu > div { | ||
color: #26a69a; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export default [ | ||
{ | ||
label: "UCLA", | ||
value: "UCLA" | ||
}, | ||
{ | ||
label: "San Diego", | ||
value: "San Diego" | ||
}, | ||
{ | ||
label: "Santa Barbara", | ||
value: "Santa Barbara" | ||
}, | ||
{ | ||
label: "Irvine", | ||
value: "Irvine" | ||
}, | ||
{ | ||
label: "San Francisco", | ||
value: "San Francisco" | ||
}, | ||
{ | ||
label: "Riverside", | ||
value: "Riverside" | ||
}, | ||
{ | ||
label: "SLO", | ||
value: "SLO" | ||
} | ||
]; |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from "react"; | ||
import Search from "../components/Search"; | ||
|
||
const Find = () => ( | ||
<div className="find"> | ||
<Search /> | ||
</div> | ||
); | ||
|
||
export default Find; |
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
Oops, something went wrong.