Skip to content

Commit

Permalink
got some good option function/style
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan Leopold committed Jan 24, 2021
1 parent 5310eaa commit 4df0aae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ form {

.inputBox > input {
box-shadow: 5px 5px 9px rgba(0,0,0, 0.20);
text-transform: capitalize;
}

.inputBox .popup {
Expand Down
11 changes: 6 additions & 5 deletions src/FlightForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class FlightForm extends Component {
let option = document.createElement("OPTION")
option.value = port.iataCode
option.dataset.country = port.address.countryCode
option.innerHTML = portName
option.innerHTML = option.name = portName
option.onclick = flightForm.handleOptionClick
newPopup.appendChild(option)
})
Expand All @@ -218,17 +218,18 @@ class FlightForm extends Component {

handleOptionClick(event) {

event.target.parentNode.previousSibling.value = event.target.name

this.setState({
[event.target.parentNode.parentNode.name]: event.target.value,
[event.target.parentNode.previousSibling.name]: event.target.value
})

if (event.target.parentNode.parentNode.name === "originPlace") {
if (event.target.parentNode.previousSibling.name === "originPlace") {
this.setState({
country: event.target.dataset.country
country: event.target.dataset.country,
})
}


event.target.parentNode.parentNode.removeChild(event.target.parentNode)

}
Expand Down

0 comments on commit 4df0aae

Please sign in to comment.