mirror of
https://github.com/strapi/strapi.git
synced 2025-11-15 09:39:15 +00:00
fix sort CM LeftMenu
This commit is contained in:
parent
a744346bd2
commit
835b47f433
@ -8,6 +8,7 @@ import React, { useMemo, useState } from 'react';
|
|||||||
import { useSelector, shallowEqual } from 'react-redux';
|
import { useSelector, shallowEqual } from 'react-redux';
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
import matchSorter from 'match-sorter';
|
import matchSorter from 'match-sorter';
|
||||||
|
import sortBy from 'lodash/sortBy';
|
||||||
import toLower from 'lodash/toLower';
|
import toLower from 'lodash/toLower';
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
@ -21,7 +22,9 @@ import getTrad from '../../../utils/getTrad';
|
|||||||
import { makeSelectModelLinks } from '../selectors';
|
import { makeSelectModelLinks } from '../selectors';
|
||||||
|
|
||||||
const matchByTitle = (links, search) =>
|
const matchByTitle = (links, search) =>
|
||||||
search ? matchSorter(links, toLower(search), { keys: [(item) => toLower(item.title)] }) : links;
|
search
|
||||||
|
? matchSorter(links, toLower(search), { keys: [(item) => toLower(item.title)] })
|
||||||
|
: sortBy(links, (object) => object.title.toLowerCase());
|
||||||
|
|
||||||
const LeftMenu = () => {
|
const LeftMenu = () => {
|
||||||
const [search, setSearch] = useState('');
|
const [search, setSearch] = useState('');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user