diff --git a/packages/pluggableWidgets/datagrid-web/CHANGELOG.md b/packages/pluggableWidgets/datagrid-web/CHANGELOG.md index 1f7339aa51..1af015b34c 100644 --- a/packages/pluggableWidgets/datagrid-web/CHANGELOG.md +++ b/packages/pluggableWidgets/datagrid-web/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Fixed + +- We fixed an issue where the footer would take up unnecessary spacing when no content was rendered inside. + ### Added - We added a new property for export to excel. The new property allows to set the cell export type and also the format for type number and date. diff --git a/packages/pluggableWidgets/datagrid-web/src/components/WidgetFooter.tsx b/packages/pluggableWidgets/datagrid-web/src/components/WidgetFooter.tsx index 4f5211c4b7..c78087a0b5 100644 --- a/packages/pluggableWidgets/datagrid-web/src/components/WidgetFooter.tsx +++ b/packages/pluggableWidgets/datagrid-web/src/components/WidgetFooter.tsx @@ -6,12 +6,19 @@ import { useSelectionCounterViewModel } from "../features/selection-counter/inje import { useDatagridConfig, usePaginationService, useTexts } from "../model/hooks/injection-hooks"; import { Pagination } from "./Pagination"; -export const WidgetFooter = observer(function WidgetFooter(): ReactElement { +export const WidgetFooter = observer(function WidgetFooter(): ReactElement | null { const config = useDatagridConfig(); const paging = usePaginationService(); const { loadMoreButtonCaption } = useTexts(); const selectionCounterVM = useSelectionCounterViewModel(); + const showLoadMore = paging.hasMoreItems && paging.pagination === "loadMore"; + const showFooter = selectionCounterVM.isBottomCounterVisible || showLoadMore || paging.pagination; + + if (!showFooter) { + return null; + } + return (
diff --git a/packages/pluggableWidgets/gallery-web/CHANGELOG.md b/packages/pluggableWidgets/gallery-web/CHANGELOG.md index cf7ad62fe3..b4fee639d8 100644 --- a/packages/pluggableWidgets/gallery-web/CHANGELOG.md +++ b/packages/pluggableWidgets/gallery-web/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Fixed + +- We fixed an issue where the footer would take up unnecessary spacing when no content was rendered inside. + ### Added - We added a refresh interval property, to allow defining an interval (in seconds) for refreshing the content in Gallery diff --git a/packages/pluggableWidgets/gallery-web/src/components/Gallery.tsx b/packages/pluggableWidgets/gallery-web/src/components/Gallery.tsx index 223a9f2e46..56d2b458b1 100644 --- a/packages/pluggableWidgets/gallery-web/src/components/Gallery.tsx +++ b/packages/pluggableWidgets/gallery-web/src/components/Gallery.tsx @@ -87,6 +87,9 @@ export function Gallery(props: GalleryProps): ReactElem const showTopSelectionCounter = selectionCounter && props.selectionCountPosition === "top"; const showBottomSelectionCounter = selectionCounter && props.selectionCountPosition === "bottom"; + const showLoadMore = props.paginationType === "loadMore"; + const showFooter = showBottomSelectionCounter || showBottomPagination || showLoadMore; + return ( (props: GalleryProps): ReactElem
{children}
))} - -
- {showBottomSelectionCounter &&
{selectionCounter}
} + {showFooter && ( + +
+ {showBottomSelectionCounter && ( +
{selectionCounter}
+ )} -
- {showBottomPagination && pagination} - {props.paginationType === "loadMore" && - (props.preview ? ( - {loadMoreButtonCaption} - ) : ( - {loadMoreButtonCaption} - ))} +
+ {showBottomPagination && pagination} + {showLoadMore && + (props.preview ? ( + {loadMoreButtonCaption} + ) : ( + {loadMoreButtonCaption} + ))} +
-
-
+ + )} ); } diff --git a/packages/pluggableWidgets/gallery-web/src/components/__tests__/__snapshots__/Gallery.spec.tsx.snap b/packages/pluggableWidgets/gallery-web/src/components/__tests__/__snapshots__/Gallery.spec.tsx.snap index 1bf1c40de9..3c0d5c3e18 100644 --- a/packages/pluggableWidgets/gallery-web/src/components/__tests__/__snapshots__/Gallery.spec.tsx.snap +++ b/packages/pluggableWidgets/gallery-web/src/components/__tests__/__snapshots__/Gallery.spec.tsx.snap @@ -53,17 +53,6 @@ exports[`Gallery DOM Structure renders correctly 1`] = `
- `; @@ -136,17 +125,6 @@ exports[`Gallery DOM Structure renders correctly with onclick event 1`] = ` - `; @@ -207,17 +185,6 @@ exports[`Gallery with accessibility properties renders correctly with items 1`] - `; @@ -256,17 +223,6 @@ exports[`Gallery with accessibility properties renders correctly without items 1 - `; @@ -304,17 +260,6 @@ exports[`Gallery with empty option renders correctly 1`] = ` - `; @@ -491,17 +436,6 @@ exports[`Gallery with pagination renders correctly 1`] = ` - `; @@ -553,17 +487,6 @@ exports[`Gallery without filters renders structure without header container 1`] - `;