Update list item limitation

Signed-off-by: HichamELBSI <elabbassih@gmail.com>
This commit is contained in:
HichamELBSI 2020-02-07 09:19:35 +01:00
parent bd284f0637
commit f534ec32a9
5 changed files with 18 additions and 6 deletions

View File

@ -5,7 +5,8 @@ import colors from '../../assets/styles/colors';
const List = styled.ul`
margin-bottom: 0;
padding-left: 0;
max-height: 180px;
max-height: ${props =>
props.numberOfVisibleItems ? `${props.numberOfVisibleItems * 35}px` : null};
overflow-y: scroll;
li {
position: relative;

View File

@ -9,7 +9,13 @@ import LeftMenuHeader from '../LeftMenuHeader';
import List from './List';
import Wrapper from './Wrapper';
function LeftMenuList({ customLink, links, title, searchable }) {
function LeftMenuList({
customLink,
links,
title,
searchable,
numberOfVisibleItems,
}) {
const [search, setSearch] = useState('');
const formatTitleWithIntl = title => {
if (isObject(title) && title.id) {
@ -87,7 +93,9 @@ function LeftMenuList({ customLink, links, title, searchable }) {
<LeftMenuHeader {...headerProps} />
</div>
<div>
<List>{getList().map((link, i) => renderCompo(link, i))}</List>
<List numberOfVisibleItems={numberOfVisibleItems}>
{getList().map((link, i) => renderCompo(link, i))}
</List>
{Component && isValidElement(<Component />) && (
<Component {...componentProps} />
)}
@ -101,6 +109,7 @@ LeftMenuList.defaultProps = {
links: [],
title: null,
searchable: false,
numberOfVisibleItems: null,
};
LeftMenuList.propTypes = {
@ -116,6 +125,7 @@ LeftMenuList.propTypes = {
id: PropTypes.string,
}),
searchable: PropTypes.bool,
numberOfVisibleItems: PropTypes.number,
};
export default LeftMenuList;

View File

@ -121,7 +121,6 @@ module.exports = {
await service.setConfiguration(uid, input);
const contentTypeConfigurations = await service.getConfiguration(uid);
const data = {
uid,
schema,

View File

@ -11,7 +11,7 @@ const getAttributes = (dataTarget = '', targetUid, nestedComponents) => {
'media',
'boolean',
'json',
// 'uid',
'uid',
'relation',
],
];

View File

@ -177,7 +177,9 @@ function LeftMenu({ wait }) {
return (
<Wrapper className="col-md-3">
{data.map(list => {
return <LeftMenuList {...list} key={list.name} />;
return (
<LeftMenuList numberOfVisibleItems={5} {...list} key={list.name} />
);
})}
</Wrapper>
);