fix(striker-ui): allow boolean header in List

main
Tsu-ba-me 2 years ago
parent 92a38374cb
commit a7ea47de30
  1. 60
      striker-ui/components/List.tsx

@ -140,36 +140,36 @@ const List = forwardRef(
isEdit,
onAllCheckboxChange,
]);
const headerElement = useMemo(
() =>
isInsertHeader && header ? (
<FlexBox row spacing={headerSpacing} sx={{ height: '2.4em' }}>
{checkAllElement}
{typeof header === 'string' ? (
<>
<BodyText>{header}</BodyText>
<Divider sx={{ flexGrow: 1 }} />
</>
) : (
header
)}
{deleteItemButton}
{editItemButton}
{addItemButton}
</FlexBox>
) : (
header
),
[
addItemButton,
checkAllElement,
deleteItemButton,
editItemButton,
header,
headerSpacing,
isInsertHeader,
],
);
const headerElement = useMemo(() => {
const headerType = typeof header;
return isInsertHeader && header ? (
<FlexBox row spacing={headerSpacing} sx={{ height: '2.4em' }}>
{checkAllElement}
{['boolean', 'string'].includes(headerType) ? (
<>
{headerType === 'string' && <BodyText>{header}</BodyText>}
<Divider sx={{ flexGrow: 1 }} />
</>
) : (
header
)}
{deleteItemButton}
{editItemButton}
{addItemButton}
</FlexBox>
) : (
header
);
}, [
addItemButton,
checkAllElement,
deleteItemButton,
editItemButton,
header,
headerSpacing,
isInsertHeader,
]);
const listEmptyElement = useMemo(
() =>
typeof listEmpty === 'string' ? (

Loading…
Cancel
Save