From a7ea47de307144b9609afa43b30e917c822537fe Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Fri, 17 Feb 2023 19:44:11 -0500 Subject: [PATCH] fix(striker-ui): allow boolean header in List --- striker-ui/components/List.tsx | 60 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/striker-ui/components/List.tsx b/striker-ui/components/List.tsx index 364146ed..d2db75f2 100644 --- a/striker-ui/components/List.tsx +++ b/striker-ui/components/List.tsx @@ -140,36 +140,36 @@ const List = forwardRef( isEdit, onAllCheckboxChange, ]); - const headerElement = useMemo( - () => - isInsertHeader && header ? ( - - {checkAllElement} - {typeof header === 'string' ? ( - <> - {header} - - - ) : ( - header - )} - {deleteItemButton} - {editItemButton} - {addItemButton} - - ) : ( - header - ), - [ - addItemButton, - checkAllElement, - deleteItemButton, - editItemButton, - header, - headerSpacing, - isInsertHeader, - ], - ); + const headerElement = useMemo(() => { + const headerType = typeof header; + + return isInsertHeader && header ? ( + + {checkAllElement} + {['boolean', 'string'].includes(headerType) ? ( + <> + {headerType === 'string' && {header}} + + + ) : ( + header + )} + {deleteItemButton} + {editItemButton} + {addItemButton} + + ) : ( + header + ); + }, [ + addItemButton, + checkAllElement, + deleteItemButton, + editItemButton, + header, + headerSpacing, + isInsertHeader, + ]); const listEmptyElement = useMemo( () => typeof listEmpty === 'string' ? (