Skip to content

Commit dee2474

Browse files
authored
chore: Fix table cell background color issue (#3596)
1 parent a98874e commit dee2474

File tree

7 files changed

+20
-0
lines changed

7 files changed

+20
-0
lines changed

src/table/body-cell/styles.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ $cell-negative-space-vertical: 2px;
253253
transition-duration: awsui.$motion-duration-transition-show-quick;
254254
transition-timing-function: awsui.$motion-easing-sticky;
255255
}
256+
&.table-variant-full-page {
257+
background: awsui.$color-background-layout-main;
258+
}
256259
&.body-cell-shaded {
257260
background: awsui.$color-background-cell-shaded;
258261
}

src/table/body-cell/td-element.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export interface TableTdElementProps {
5656
isEditing: boolean;
5757
isEditingDisabled?: boolean;
5858
hasSuccessIcon?: boolean;
59+
tableVariant?: string;
5960
}
6061

6162
export const TableTdElement = React.forwardRef<HTMLTableCellElement, TableTdElementProps>(
@@ -95,6 +96,7 @@ export const TableTdElement = React.forwardRef<HTMLTableCellElement, TableTdElem
9596
isEditing,
9697
isEditingDisabled,
9798
hasSuccessIcon,
99+
tableVariant,
98100
...rest
99101
},
100102
ref
@@ -141,6 +143,7 @@ export const TableTdElement = React.forwardRef<HTMLTableCellElement, TableTdElem
141143
hasSuccessIcon && styles['body-cell-has-success'],
142144
level !== undefined && !isEditingActive && styles['body-cell-expandable'],
143145
level !== undefined && !isEditingActive && styles[`expandable-level-${getLevelClassSuffix(level)}`],
146+
tableVariant && styles[`table-variant-${tableVariant}`],
144147
stickyStyles.className
145148
)}
146149
onClick={onClick}

src/table/header-cell/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export interface TableHeaderCellProps<ItemType> {
4949
isExpandable?: boolean;
5050
hasDynamicContent?: boolean;
5151
variant: TableProps.Variant;
52+
tableVariant?: string;
5253
}
5354

5455
export function TableHeaderCell<ItemType>({
@@ -78,6 +79,7 @@ export function TableHeaderCell<ItemType>({
7879
isExpandable,
7980
hasDynamicContent,
8081
variant,
82+
tableVariant,
8183
}: TableHeaderCellProps<ItemType>) {
8284
const i18n = useInternalI18n('table');
8385
const sortable = !!column.sortingComparator || !!column.sortingField;
@@ -133,6 +135,7 @@ export function TableHeaderCell<ItemType>({
133135
stickyState={stickyState}
134136
tableRole={tableRole}
135137
variant={variant}
138+
tableVariant={tableVariant}
136139
{...(sortingDisabled
137140
? {}
138141
: getAnalyticsMetadataAttribute({

src/table/header-cell/styles.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ $cell-horizontal-padding: awsui.$space-scaled-l;
9393
transition-duration: awsui.$motion-duration-transition-show-quick;
9494
transition-timing-function: awsui.$motion-easing-sticky;
9595
}
96+
&.table-variant-full-page {
97+
background: awsui.$color-background-layout-main;
98+
}
9699
&-pad-left:not(.has-selection) {
97100
padding-inline-start: awsui.$space-table-horizontal;
98101
}

src/table/header-cell/th-element.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export interface TableThElementProps {
3636
children: React.ReactNode;
3737
variant: TableProps.Variant;
3838
ariaLabel?: string;
39+
tableVariant?: string;
3940
}
4041

4142
export function TableThElement({
@@ -56,6 +57,7 @@ export function TableThElement({
5657
children,
5758
variant,
5859
ariaLabel,
60+
tableVariant,
5961
...props
6062
}: TableThElementProps) {
6163
const isVisualRefresh = useVisualRefresh();
@@ -81,6 +83,7 @@ export function TableThElement({
8183
stripedRows && styles['has-striped-rows'],
8284
isVisualRefresh && styles['is-visual-refresh'],
8385
isSelection && clsx(tableStyles['selection-control'], tableStyles['selection-control-header']),
86+
tableVariant && styles[`table-variant-${tableVariant}`],
8487
{
8588
[styles['header-cell-fake-focus']]: focusedComponent === `header-${String(columnId)}`,
8689
[styles['header-cell-sortable']]: sortingStatus,

src/table/internal.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ const InternalTable = React.forwardRef(
379379
getSelectAllProps,
380380
columnDefinitions: visibleColumnDefinitions,
381381
variant: computedVariant,
382+
tableVariant: computedVariant,
382383
wrapLines,
383384
resizableColumns,
384385
sortingColumn,
@@ -680,6 +681,7 @@ const InternalTable = React.forwardRef(
680681
columnId={column.id ?? colIndex}
681682
colIndex={colIndex + colIndexOffset}
682683
verticalAlign={column.verticalAlign ?? cellVerticalAlign}
684+
tableVariant={computedVariant}
683685
{...cellExpandableProps}
684686
{...getAnalyticsMetadataAttribute(analyticsMetadata)}
685687
/>

src/table/thead.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface TheadProps {
2424
sortingDescending: boolean | undefined;
2525
sortingDisabled: boolean | undefined;
2626
variant: TableProps.Variant;
27+
tableVariant?: string;
2728
wrapLines: boolean | undefined;
2829
resizableColumns: boolean | undefined;
2930
getSelectAllProps?: () => SelectionProps;
@@ -56,6 +57,7 @@ const Thead = React.forwardRef(
5657
sortingDescending,
5758
resizableColumns,
5859
variant,
60+
tableVariant,
5961
wrapLines,
6062
onFocusMove,
6163
onSortingChange,
@@ -85,6 +87,7 @@ const Thead = React.forwardRef(
8587
stripedRows,
8688
tableRole,
8789
variant,
90+
tableVariant,
8891
stickyState,
8992
};
9093

0 commit comments

Comments
 (0)