diff --git a/components/AriaTable/AriaTable.tsx b/components/AriaTable/AriaTable.tsx index a50e0822..c6b8b004 100644 --- a/components/AriaTable/AriaTable.tsx +++ b/components/AriaTable/AriaTable.tsx @@ -67,7 +67,7 @@ const AnimatedContainer = ({ isOpen, children }: { isOpen: boolean; children: Re pointerEvents: 'none', border: 'none', }, - [isOpen] + [isOpen], ); const containerStyle = useMemo( @@ -84,7 +84,7 @@ const AnimatedContainer = ({ isOpen, children }: { isOpen: boolean; children: Re overflow: 'hidden', padding: '0px 16px', }, - [isOpen] + [isOpen], ); return ( @@ -151,7 +151,7 @@ export const Tr = forwardRef, TrProps>( ) : null, // eslint-disable-next-line react-hooks/exhaustive-deps - [isCollapsed] + [isCollapsed], ); const renderedChildren = useMemo(() => { @@ -163,7 +163,7 @@ export const Tr = forwardRef, TrProps>( ...children?.props, }, // @ts-ignore: Object is possibly 'null'. - [TdEl, ...(children?.props?.children || [])] + [TdEl, ...(children?.props?.children || [])], ); } @@ -184,7 +184,7 @@ export const Tr = forwardRef, TrProps>( !!collapsedContent && !isCollapsed ? { ...css, - [`&:nth-last-child(2) span`]: { + [`&:nth-last-child(2) > span`]: { borderBottom: 'none', }, } @@ -199,7 +199,7 @@ export const Tr = forwardRef, TrProps>( )} ); - } + }, ); const StyledTh = styled('span', TableTh, { @@ -235,7 +235,7 @@ export const Td = forwardRef, TdProps>( height: '100%', } : {}, - [fullColSpan] + [fullColSpan], ); if (fullColSpan) { return ( @@ -246,7 +246,7 @@ export const Td = forwardRef, TdProps>( ); } return ; - } + }, ); const StyledThead = styled('div', TableThead, { diff --git a/components/Table/Table.stories.tsx b/components/Table/Table.stories.tsx index 8fef365a..c05553bf 100644 --- a/components/Table/Table.stories.tsx +++ b/components/Table/Table.stories.tsx @@ -705,4 +705,67 @@ CollapsibleRow.args = { elevation: '1', }; +export const NestedCollapsibleRow: StoryFn = ({ interactive, ...args }) => { + const [selectedRow, setSelectedRow] = useState(1); + const makeSelectableRowProps = useCallback( + (rowNum: number) => ({ + active: selectedRow === rowNum, + onClick: () => setSelectedRow(rowNum), + }), + [selectedRow, setSelectedRow], + ); + + return ( + + + + + First name + Last name + Status + Role + + + + + This is an additional description of this row above. It could be anything. + + } + collapsedContentColSpan={5} + {...makeSelectableRowProps(2)} + > + Johnny + Depp + + AFK + + Actor + + } + collapsedContentColSpan={5} + interactive={interactive} + {...makeSelectableRowProps(3)} + > + Natalie + Portman + + Connected + + Actor + + + + + ); +}; + +NestedCollapsibleRow.args = { + interactive: true, + elevation: '1', +}; + export default Component; diff --git a/components/Table/Table.tsx b/components/Table/Table.tsx index 6a1f15f2..4ab90c0c 100644 --- a/components/Table/Table.tsx +++ b/components/Table/Table.tsx @@ -92,7 +92,7 @@ export const StyledTr = styled('tr', { '&:hover': { color: '$tableHoverText', }, - [`&:last-child ${Td}`]: { + [`&:last-child > ${Td}`]: { borderBottom: 'none', }, @@ -146,7 +146,7 @@ const AnimatedTr = ({ padding: '0px 16px', border: 'none', }, - [isOpen] + [isOpen], ); const containerStyle = useMemo( @@ -158,7 +158,7 @@ const AnimatedTr = ({ height: 0, overflow: 'hidden', }, - [isOpen] + [isOpen], ); return ( @@ -188,7 +188,7 @@ export const Tr = forwardRef, TrProps>( css, ...props }, - ref + ref, ) => { const [isCollapsed, setIsCollapsed] = useState(false); @@ -200,7 +200,7 @@ export const Tr = forwardRef, TrProps>( !!collapsedContent && !isCollapsed ? { ...css, - [`&:nth-last-child(2) ${Td}`]: { + [`&:nth-last-child(2) > ${Td}`]: { borderBottom: 'none', }, } @@ -247,7 +247,7 @@ export const Tr = forwardRef, TrProps>( )} ); - } + }, ); export const Tfoot = styled('tfoot', {