From c6d4783294b3f9e00ce00a99f6852cc7fa016a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr> Date: Tue, 30 Apr 2024 17:45:11 +0200 Subject: [PATCH] [ivette] show more button --- ivette/src/frama-c/kernel/Globals.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ivette/src/frama-c/kernel/Globals.tsx b/ivette/src/frama-c/kernel/Globals.tsx index fea282c1d31..53dc1942357 100644 --- a/ivette/src/frama-c/kernel/Globals.tsx +++ b/ivette/src/frama-c/kernel/Globals.tsx @@ -106,6 +106,10 @@ function List(props: ListProps): JSX.Element { const { name, total, filteringMenuItems, children } = props; const Name = name.charAt(0).toUpperCase() + name.slice(1); const count = children.length; + const [slice, setSlice] = React.useState(1500); + React.useEffect(() => { + if (count < slice) setSlice(1500); + }, [count]); const filterButtonProps = { icon: 'TUNINGS', @@ -131,11 +135,16 @@ function List(props: ListProps): JSX.Element { const omittedItems = <div className='dome-xSideBarSection-content'> <label className='globals-info'> - ({children.length - 1500} omitted) + ({count - slice} omitted) </label> + <Button + icon='CIRC.PLUS' + label="Show more" + onClick={() => setSlice(slice+500)} + /> </div>; - const items = children.length > 1500 ? children.slice(0, 1500) : children; + const items = count > slice ? children.slice(0, slice) : children; return ( <Section -- GitLab