Bug/collection type sort asc (#8706)

* fixed leftmenu sorting bug in content-types-builder

Signed-off-by: akhilmhdh <akhilmhdh@gmail.com>

* changed js toLowerCase to lodash toLower

Signed-off-by: akhilmhdh <akhilmhdh@gmail.com>

Co-authored-by: cyril lopez <cyril.lpz@gmail.com>
This commit is contained in:
Akhil Mohan 2020-12-04 15:33:55 +05:30 committed by GitHub
parent bbff091b88
commit 96db1488bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import React, { isValidElement, useState } from 'react';
import PropTypes from 'prop-types';
import { get, isEmpty, isObject } from 'lodash';
import { get, isEmpty, isObject, toLower } from 'lodash';
import { useGlobalContext } from '../../contexts/GlobalContext';
import matchSorter from 'match-sorter';
import LeftMenuLink from '../LeftMenuLink';
@ -54,12 +54,13 @@ function LeftMenuList({ customLink, links, title, searchable }) {
return links.map(link => {
return {
...link,
links: matchSorter(link.links, search, { keys: ['title'] }),
links: matchSorter(link.links, toLower(search), {
keys: [item => toLower(item.title)],
}),
};
});
}
return matchSorter(links, search, { keys: ['title'] });
return matchSorter(links, toLower(search), { keys: [item => toLower(item.title)] });
};
const renderCompo = (link, i) => {