Skip to content

Commit a87a200

Browse files
anuraghazratewarig
andauthored
chore: add data attributes in TabNav & Table components (#2462)
* chore: add data attributes in TabNav & Table components * Create stupid-apples-fry.md * chore: update snap * chore: update snaps --------- Co-authored-by: tewarig <[email protected]>
1 parent f07937d commit a87a200

File tree

11 files changed

+230
-191
lines changed

11 files changed

+230
-191
lines changed

.changeset/stupid-apples-fry.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@razorpay/blade": patch
3+
---
4+
5+
chore(blade): add data attributes in TabNav & Table components

packages/blade/src/components/Table/TableBody.web.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ const _TableCell = ({ children, _hasPadding, ...rest }: TableCellProps): React.R
309309
// allow text to wrap, so that if the <Text> overflows it can truncate
310310
whiteSpace="normal"
311311
position="relative"
312+
{...metaAttribute({ name: MetaConstants.TableCellWrapper })}
312313
>
313314
{isChildrenString ? (
314315
<Text size="medium" truncateAfterLines={1}>

packages/blade/src/components/Table/TableHeader.web.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ const SortIcon = ({
5353
const upArrowColor = isSorted && isSortReversed ? activeColor : defaultColor;
5454
const downArrowColor = isSorted && !isSortReversed ? activeColor : defaultColor;
5555
return (
56-
<SortButton {...makeAccessible({ label: 'Toggle Sort', role: 'button' })}>
56+
<SortButton
57+
{...metaAttribute({ name: MetaConstants.TableSortButton })}
58+
{...makeAccessible({ label: 'Toggle Sort', role: 'button' })}
59+
>
5760
<svg width={20} height={20} fill="none">
5861
<path
5962
fill={upArrowColor}

packages/blade/src/components/Table/TablePagination.web.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,15 @@ import { useTheme } from '~components/BladeProvider';
2626
import { throwBladeError } from '~utils/logger';
2727
import { getFocusRingStyles } from '~utils/getFocusRingStyles';
2828
import { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';
29+
import { metaAttribute, MetaConstants } from '~utils/metaAttribute';
2930

3031
const pageSizeOptions: NonNullable<TablePaginationCommonProps['defaultPageSize']>[] = [10, 25, 50];
3132

32-
const PageSelectionButton = styled.button<{ isSelected?: boolean }>(({ theme, isSelected }) => ({
33+
const PageSelectionButton = styled.button.attrs(() => {
34+
return {
35+
...metaAttribute({ name: MetaConstants.TablePageSelectionButton }),
36+
};
37+
})<{ isSelected?: boolean }>(({ theme, isSelected }) => ({
3338
backgroundColor: isSelected
3439
? getIn(theme.colors, tablePagination.pageSelectionButton.backgroundColorSelected)
3540
: 'transparent',

0 commit comments

Comments
 (0)