Capitalize city (#3)

This commit is contained in:
dbroqua 2020-03-04 18:45:01 +01:00
parent 723d67f482
commit c14839430c
3 changed files with 11 additions and 7 deletions

View File

@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import { FaWaze } from "react-icons/fa"; import { FaWaze } from "react-icons/fa";
import { gasTypes } from "../config"; import { gasTypes } from "../config";
import { capitalizeFirstLetter} from "../helpers"; import { capitalizeFirstLetter, lowerCaseString } from "../helpers";
class GasStation extends React.Component { class GasStation extends React.Component {
/** /**
@ -62,7 +62,7 @@ class GasStation extends React.Component {
> >
<Modal.Header closeButton> <Modal.Header closeButton>
<Modal.Title> <Modal.Title>
{`${selectedGasStation.address} - ${capitalizeFirstLetter(selectedGasStation.city)}`} {`${lowerCaseString(selectedGasStation.address)} - ${capitalizeFirstLetter(selectedGasStation.city)}`}
</Modal.Title> </Modal.Title>
</Modal.Header> </Modal.Header>
<Modal.Body> <Modal.Body>

View File

@ -22,10 +22,7 @@ class Map extends React.Component {
longitude: -0.57918, longitude: -0.57918,
zoom: 11, zoom: 11,
}, },
userLocation: { userLocation: {},
// latitude: 44.837789,
// longitude: -0.57918,
},
gasStations: [], gasStations: [],
}; };

View File

@ -11,9 +11,16 @@ export const haveSelectedGas = (station, gas) => {
return false; return false;
} }
export const lowerCaseString = (string) => {
if ( !string){
return '';
}
return string.toLowerCase();
}
export const capitalizeFirstLetter = (string) => { export const capitalizeFirstLetter = (string) => {
if ( !string){ if ( !string){
return ''; return '';
} }
return string.charAt(0).toUpperCase() + string.slice(1); return string.charAt(0).toUpperCase() + lowerCaseString(string.slice(1));
} }