Skip to content
Snippets Groups Projects
Commit c6d47832 authored by Loïc Correnson's avatar Loïc Correnson Committed by Loïc Correnson
Browse files

[ivette] show more button

parent 9cadd6da
No related branches found
No related tags found
No related merge requests found
...@@ -106,6 +106,10 @@ function List(props: ListProps): JSX.Element { ...@@ -106,6 +106,10 @@ function List(props: ListProps): JSX.Element {
const { name, total, filteringMenuItems, children } = props; const { name, total, filteringMenuItems, children } = props;
const Name = name.charAt(0).toUpperCase() + name.slice(1); const Name = name.charAt(0).toUpperCase() + name.slice(1);
const count = children.length; const count = children.length;
const [slice, setSlice] = React.useState(1500);
React.useEffect(() => {
if (count < slice) setSlice(1500);
}, [count]);
const filterButtonProps = { const filterButtonProps = {
icon: 'TUNINGS', icon: 'TUNINGS',
...@@ -131,11 +135,16 @@ function List(props: ListProps): JSX.Element { ...@@ -131,11 +135,16 @@ function List(props: ListProps): JSX.Element {
const omittedItems = const omittedItems =
<div className='dome-xSideBarSection-content'> <div className='dome-xSideBarSection-content'>
<label className='globals-info'> <label className='globals-info'>
({children.length - 1500} omitted) ({count - slice} omitted)
</label> </label>
<Button
icon='CIRC.PLUS'
label="Show more"
onClick={() => setSlice(slice+500)}
/>
</div>; </div>;
const items = children.length > 1500 ? children.slice(0, 1500) : children; const items = count > slice ? children.slice(0, slice) : children;
return ( return (
<Section <Section
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment