Merge branch '3-mettre-en-capitalize-les-adresses-et-ville-des-stations' into 'master'

Resolve "Mettre en capitalize les adresses et ville des stations"

Closes #3

See merge request dbroqua/prix-carburants!2
This commit is contained in:
Damien Broqua 2020-03-04 18:46:04 +01:00
commit 6bd009c4b5
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));
} }