Merge pull request #294 from mirumee/fix/shipping-screen-countries-sorting
Fix issue with country sorting on shipping page
This commit is contained in:
commit
be0d3e1a05
1 changed files with 5 additions and 1 deletions
|
@ -89,6 +89,10 @@ const CountryList: React.FC<CountryListProps> = props => {
|
||||||
const [isCollapsed, setCollapseStatus] = React.useState(true);
|
const [isCollapsed, setCollapseStatus] = React.useState(true);
|
||||||
const toggleCollapse = () => setCollapseStatus(!isCollapsed);
|
const toggleCollapse = () => setCollapseStatus(!isCollapsed);
|
||||||
|
|
||||||
|
function sortCountries(countries: CountryFragment[]): CountryFragment[] {
|
||||||
|
return [...countries].sort((a, b) => a.country.localeCompare(b.country));
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardTitle
|
<CardTitle
|
||||||
|
@ -131,7 +135,7 @@ const CountryList: React.FC<CountryListProps> = props => {
|
||||||
</TableRow>
|
</TableRow>
|
||||||
{!isCollapsed &&
|
{!isCollapsed &&
|
||||||
renderCollection(
|
renderCollection(
|
||||||
countries,
|
sortCountries(countries),
|
||||||
(country, countryIndex) => (
|
(country, countryIndex) => (
|
||||||
<TableRow key={country ? country.code : "skeleton"}>
|
<TableRow key={country ? country.code : "skeleton"}>
|
||||||
<TableCell className={classes.offsetCell}>
|
<TableCell className={classes.offsetCell}>
|
||||||
|
|
Loading…
Reference in a new issue