From c958872865db3348c1efab2c758581820075556e Mon Sep 17 00:00:00 2001 From: alx-chernigin Date: Fri, 15 Nov 2024 15:23:05 +0300 Subject: [PATCH] feat(Table): remove bottom border from last row --- src/components/Table/Table.scss | 6 ++++++ src/components/Table/Table.tsx | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/components/Table/Table.scss b/src/components/Table/Table.scss index 32f9312..f6cbd86 100644 --- a/src/components/Table/Table.scss +++ b/src/components/Table/Table.scss @@ -32,4 +32,10 @@ $block: '.#{variables.$ns}styled-table'; padding: var(--_--cell-padding); border-block-end: 1px solid var(--g-color-line-generic); } + + &__row:last-of-type { + #{$block}__cell { + border-block-end: none; + } + } } diff --git a/src/components/Table/Table.tsx b/src/components/Table/Table.tsx index fb5c82e..9907636 100644 --- a/src/components/Table/Table.tsx +++ b/src/components/Table/Table.tsx @@ -21,6 +21,7 @@ export const Table = React.forwardRef( cellClassName: cellClassNameProp, footerCellClassName: footerCellClassNameProp, headerCellClassName: headerCellClassNameProp, + rowClassName: rowClassNameProp, headerClassName, size = 'm', ...props @@ -51,6 +52,14 @@ export const Table = React.forwardRef( return b('footer-cell', footerCellClassNameProp); }, [footerCellClassNameProp]); + const rowClassName: TableProps['rowClassName'] = React.useMemo(() => { + if (typeof rowClassNameProp === 'function') { + return (...args) => b('row', rowClassNameProp(...args)); + } + + return b('row', rowClassNameProp); + }, [rowClassNameProp]); + return ( );