From 107a1476b0c42160b2590227d3ac39386dec839f Mon Sep 17 00:00:00 2001 From: Heikki Hellgren Date: Sat, 14 Sep 2024 14:00:43 +0300 Subject: [PATCH 1/2] fix: table width overriden with custom styles when custom styles are passed to Table component, they override the default width 100%. moving the style out of restProps fixes this issue while still allows customizing the width if wanted. Signed-off-by: Heikki Hellgren --- .changeset/giant-seas-smile.md | 5 +++++ packages/core-components/src/components/Table/Table.tsx | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/giant-seas-smile.md diff --git a/.changeset/giant-seas-smile.md b/.changeset/giant-seas-smile.md new file mode 100644 index 0000000000..6c5bd899e7 --- /dev/null +++ b/.changeset/giant-seas-smile.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-components': patch +--- + +Fixed Table width being overriden by custom styling diff --git a/packages/core-components/src/components/Table/Table.tsx b/packages/core-components/src/components/Table/Table.tsx index e0bd3541f5..bcd411934b 100644 --- a/packages/core-components/src/components/Table/Table.tsx +++ b/packages/core-components/src/components/Table/Table.tsx @@ -350,6 +350,7 @@ export function Table(props: TableProps) { onStateChange, components, isLoading: loading, + style, ...restProps } = props; const tableClasses = useTableStyles(); @@ -483,7 +484,7 @@ export function Table(props: TableProps) { } data={tableData} - style={{ width: '100%' }} + style={{ width: '100%', ...style }} localization={{ toolbar: { searchPlaceholder: 'Filter', searchTooltip: 'Filter' }, ...localization, From 7b509c60f3a21e0c04f44159e7d2ab5bcf87e7ad Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 14 Sep 2024 14:45:33 +0200 Subject: [PATCH 2/2] Update .changeset/giant-seas-smile.md Signed-off-by: Patrik Oldsberg --- .changeset/giant-seas-smile.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/giant-seas-smile.md b/.changeset/giant-seas-smile.md index 6c5bd899e7..e2df4275bd 100644 --- a/.changeset/giant-seas-smile.md +++ b/.changeset/giant-seas-smile.md @@ -2,4 +2,4 @@ '@backstage/core-components': patch --- -Fixed Table width being overriden by custom styling +Fixed `Table` width being overridden by custom `style` prop.