From 97fcb20a94ebbd24ff59f78fce8c256b6ab700a2 Mon Sep 17 00:00:00 2001 From: Julia Rechkunova Date: Wed, 21 Feb 2024 22:12:20 +0100 Subject: [PATCH] [Discover] Fix horizontal rule in Additional display settings popover (#177460) - Noticed in https://github.com/elastic/kibana/pull/176064 ## Summary This PR renders `EuiHorizontalRule` only between available options. Before: Screenshot 2024-02-21 at 15 57 24 After: Screenshot 2024-02-21 at 15 56 47 --- ...data_table_additional_display_settings.tsx | 103 ++++++++++-------- 1 file changed, 57 insertions(+), 46 deletions(-) diff --git a/packages/kbn-unified-data-table/src/components/data_table_additional_display_settings.tsx b/packages/kbn-unified-data-table/src/components/data_table_additional_display_settings.tsx index 164ab402dd46d..f57127d185a94 100644 --- a/packages/kbn-unified-data-table/src/components/data_table_additional_display_settings.tsx +++ b/packages/kbn-unified-data-table/src/components/data_table_additional_display_settings.tsx @@ -90,54 +90,65 @@ export const UnifiedDataTableAdditionalDisplaySettings: React.FC< setActiveSampleSize(sampleSize); // reset local state }, [sampleSize, setActiveSampleSize]); + const settings = []; + + if (onChangeHeaderRowHeight && onChangeHeaderRowHeightLines) { + settings.push( + + ); + } + + if (onChangeRowHeight && onChangeRowHeightLines) { + settings.push( + + ); + } + + if (onChangeSampleSize) { + settings.push( + + + + ); + } + return ( <> - {onChangeHeaderRowHeight && onChangeHeaderRowHeightLines && ( - - )} - {onChangeRowHeight && onChangeRowHeightLines && ( - <> - - - - )} - {onChangeSampleSize && ( - <> - - - - - - )} + {settings.map((setting, index) => ( + + {index > 0 && } + {setting} + + ))} ); };