Commit 79eb7cb6 authored by Sharp Hall's avatar Sharp Hall

Add nice directions

parent a7949670
{
"presets": [
"@babel/env",
"@babel/react"
]
"@babel/react",
],
"plugins": ["@babel/plugin-proposal-class-properties"]
}
......@@ -56,6 +56,13 @@ $(function () {
});
class Vehicle extends React.Component {
static NICE_DIRECTIONS = {
'NorthBound': 'going north',
'SouthBound': 'going south',
'WestBound': 'going west',
'EastBound': 'going east',
}
render() {
var distance;
if (this.props.vehicleData.distance > 0.2) {
......@@ -63,9 +70,10 @@ class Vehicle extends React.Component {
} else {
distance = (this.props.vehicleData.distance * 5280).toFixed(0) + " feet";
}
var nice_directions = Vehicle.NICE_DIRECTIONS[this.props.vehicleData.Direction];
return (
<div className="vehicle">
{this.props.vehicleData.Direction} {this.props.vehicleData.route} {distance} away
{this.props.vehicleData.route} {nice_directions} {distance} away
</div>
);
}
......
......@@ -105,6 +105,20 @@
"@babel/types": "7.5.5"
}
},
"@babel/helper-create-class-features-plugin": {
"version": "7.5.5",
"resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.5.5.tgz",
"integrity": "sha512-ZsxkyYiRA7Bg+ZTRpPvB6AbOFKTFFK4LrvTet8lInm0V468MWCaSYJE+I7v2z2r8KNLtYiV+K5kTCnR7dvyZjg==",
"dev": true,
"requires": {
"@babel/helper-function-name": "7.1.0",
"@babel/helper-member-expression-to-functions": "7.5.5",
"@babel/helper-optimise-call-expression": "7.0.0",
"@babel/helper-plugin-utils": "7.0.0",
"@babel/helper-replace-supers": "7.5.5",
"@babel/helper-split-export-declaration": "7.4.4"
}
},
"@babel/helper-define-map": {
"version": "7.5.5",
"resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.5.5.tgz",
......@@ -286,6 +300,16 @@
"@babel/plugin-syntax-async-generators": "7.2.0"
}
},
"@babel/plugin-proposal-class-properties": {
"version": "7.5.5",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.5.tgz",
"integrity": "sha512-AF79FsnWFxjlaosgdi421vmYG6/jg79bVD0dpD44QdgobzHKuLZ6S3vl8la9qIeSwGi8i1fS0O1mfuDAAdo1/A==",
"dev": true,
"requires": {
"@babel/helper-create-class-features-plugin": "7.5.5",
"@babel/helper-plugin-utils": "7.0.0"
}
},
"@babel/plugin-proposal-dynamic-import": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.5.0.tgz",
......@@ -768,6 +792,12 @@
"@babel/plugin-transform-react-jsx-source": "7.5.0"
}
},
"@babel/preset-stage-3": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/@babel/preset-stage-3/-/preset-stage-3-7.0.0.tgz",
"integrity": "sha512-/zrA33dt21H6wV0nqXUIb7miaodavqY9DFEbuBjH9TtcPvhfVgV0klRPoO+Pdm0eUSXkXoponS+1I2HweyTrLQ==",
"dev": true
},
"@babel/template": {
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz",
......
......@@ -11,7 +11,9 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/preset-react": "^7.0.0",
"@babel/preset-stage-3": "^7.0.0",
"babel-loader": "^8.0.6",
"webpack": "^4.39.3",
"webpack-cli": "^3.3.7",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment