From f534ec32a91a18aa660dc91294d49eef4b91a7b1 Mon Sep 17 00:00:00 2001 From: HichamELBSI Date: Fri, 7 Feb 2020 09:19:35 +0100 Subject: [PATCH] Update list item limitation Signed-off-by: HichamELBSI --- .../lib/src/components/LeftMenuList/List.js | 3 ++- .../lib/src/components/LeftMenuList/index.js | 14 ++++++++++++-- .../controllers/ContentTypes.js | 1 - .../src/containers/FormModal/utils/attributes.js | 2 +- .../admin/src/containers/LeftMenu/index.js | 4 +++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/strapi-helper-plugin/lib/src/components/LeftMenuList/List.js b/packages/strapi-helper-plugin/lib/src/components/LeftMenuList/List.js index 90e3694537..185ac863d2 100644 --- a/packages/strapi-helper-plugin/lib/src/components/LeftMenuList/List.js +++ b/packages/strapi-helper-plugin/lib/src/components/LeftMenuList/List.js @@ -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; diff --git a/packages/strapi-helper-plugin/lib/src/components/LeftMenuList/index.js b/packages/strapi-helper-plugin/lib/src/components/LeftMenuList/index.js index 1a66c912e5..e6c5f6556e 100644 --- a/packages/strapi-helper-plugin/lib/src/components/LeftMenuList/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/LeftMenuList/index.js @@ -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 }) {
- {getList().map((link, i) => renderCompo(link, i))} + + {getList().map((link, i) => renderCompo(link, i))} + {Component && isValidElement() && ( )} @@ -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; diff --git a/packages/strapi-plugin-content-manager/controllers/ContentTypes.js b/packages/strapi-plugin-content-manager/controllers/ContentTypes.js index ef3650cc0e..b376f8313a 100644 --- a/packages/strapi-plugin-content-manager/controllers/ContentTypes.js +++ b/packages/strapi-plugin-content-manager/controllers/ContentTypes.js @@ -121,7 +121,6 @@ module.exports = { await service.setConfiguration(uid, input); const contentTypeConfigurations = await service.getConfiguration(uid); - const data = { uid, schema, diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/FormModal/utils/attributes.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/FormModal/utils/attributes.js index d69f75eee4..5621349ca8 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/FormModal/utils/attributes.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/FormModal/utils/attributes.js @@ -11,7 +11,7 @@ const getAttributes = (dataTarget = '', targetUid, nestedComponents) => { 'media', 'boolean', 'json', - // 'uid', + 'uid', 'relation', ], ]; diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/LeftMenu/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/LeftMenu/index.js index b55069a0f4..c1d538ddf7 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/LeftMenu/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/LeftMenu/index.js @@ -177,7 +177,9 @@ function LeftMenu({ wait }) { return ( {data.map(list => { - return ; + return ( + + ); })} );