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

Merged
dbroqua merged 1 commit from 3-mettre-en-capitalize-les-adresses-et-ville-des-stations into master 2020-03-04 18:46:05 +01:00
3 changed files with 11 additions and 7 deletions
Showing only changes of commit c14839430c - Show all commits

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));
} }