Skip to content

Commit 51b5179

Browse files
committed
chore: revert null pass after package update
1 parent 219ca0f commit 51b5179

File tree

5 files changed

+36
-91
lines changed

5 files changed

+36
-91
lines changed

packages/pluggableWidgets/datagrid-web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- We fixed an issue where the footer would take up unnecessary spacing when no content was rendered inside.
12+
913
### Added
1014

1115
- 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.

packages/pluggableWidgets/datagrid-web/src/components/WidgetFooter.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@ import { useSelectionCounterViewModel } from "../features/selection-counter/inje
66
import { useDatagridConfig, usePaginationService, useTexts } from "../model/hooks/injection-hooks";
77
import { Pagination } from "./Pagination";
88

9-
export const WidgetFooter = observer(function WidgetFooter(): ReactElement {
9+
export const WidgetFooter = observer(function WidgetFooter(): ReactElement | null {
1010
const config = useDatagridConfig();
1111
const paging = usePaginationService();
1212
const { loadMoreButtonCaption } = useTexts();
1313
const selectionCounterVM = useSelectionCounterViewModel();
1414

15+
const showLoadMore = paging.hasMoreItems && paging.pagination === "loadMore";
16+
const showFooter = selectionCounterVM.isBottomCounterVisible || showLoadMore || paging.pagination;
17+
18+
if (!showFooter) {
19+
return null;
20+
}
21+
1522
return (
1623
<div className="widget-datagrid-footer table-footer">
1724
<div className="widget-datagrid-paging-bottom">

packages/pluggableWidgets/gallery-web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- We fixed an issue where the footer would take up unnecessary spacing when no content was rendered inside.
12+
913
### Added
1014

1115
- We added a refresh interval property, to allow defining an interval (in seconds) for refreshing the content in Gallery

packages/pluggableWidgets/gallery-web/src/components/Gallery.tsx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ export function Gallery<T extends ObjectItem>(props: GalleryProps<T>): ReactElem
8787
const showTopSelectionCounter = selectionCounter && props.selectionCountPosition === "top";
8888
const showBottomSelectionCounter = selectionCounter && props.selectionCountPosition === "bottom";
8989

90+
const showLoadMore = props.paginationType === "loadMore";
91+
const showFooter = showBottomSelectionCounter || showBottomPagination || showLoadMore;
92+
9093
return (
9194
<GalleryRoot
9295
className={props.className}
@@ -140,21 +143,25 @@ export function Gallery<T extends ObjectItem>(props: GalleryProps<T>): ReactElem
140143
<div className="empty-placeholder">{children}</div>
141144
</section>
142145
))}
143-
<GalleryFooter>
144-
<div className="widget-gallery-footer-controls">
145-
{showBottomSelectionCounter && <div className="widget-gallery-fc-start">{selectionCounter}</div>}
146+
{showFooter && (
147+
<GalleryFooter>
148+
<div className="widget-gallery-footer-controls">
149+
{showBottomSelectionCounter && (
150+
<div className="widget-gallery-fc-start">{selectionCounter}</div>
151+
)}
146152

147-
<div className="widget-gallery-fc-end">
148-
{showBottomPagination && pagination}
149-
{props.paginationType === "loadMore" &&
150-
(props.preview ? (
151-
<LoadMorePreview>{loadMoreButtonCaption}</LoadMorePreview>
152-
) : (
153-
<LoadMore>{loadMoreButtonCaption}</LoadMore>
154-
))}
153+
<div className="widget-gallery-fc-end">
154+
{showBottomPagination && pagination}
155+
{showLoadMore &&
156+
(props.preview ? (
157+
<LoadMorePreview>{loadMoreButtonCaption}</LoadMorePreview>
158+
) : (
159+
<LoadMore>{loadMoreButtonCaption}</LoadMore>
160+
))}
161+
</div>
155162
</div>
156-
</div>
157-
</GalleryFooter>
163+
</GalleryFooter>
164+
)}
158165
</GalleryRoot>
159166
);
160167
}

packages/pluggableWidgets/gallery-web/src/components/__tests__/__snapshots__/Gallery.spec.tsx.snap

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,6 @@ exports[`Gallery DOM Structure renders correctly 1`] = `
5353
</div>
5454
</div>
5555
</div>
56-
<div
57-
class="widget-gallery-footer"
58-
>
59-
<div
60-
class="widget-gallery-footer-controls"
61-
>
62-
<div
63-
class="widget-gallery-fc-end"
64-
/>
65-
</div>
66-
</div>
6756
</div>
6857
</DocumentFragment>
6958
`;
@@ -136,17 +125,6 @@ exports[`Gallery DOM Structure renders correctly with onclick event 1`] = `
136125
</div>
137126
</div>
138127
</div>
139-
<div
140-
class="widget-gallery-footer"
141-
>
142-
<div
143-
class="widget-gallery-footer-controls"
144-
>
145-
<div
146-
class="widget-gallery-fc-end"
147-
/>
148-
</div>
149-
</div>
150128
</div>
151129
</DocumentFragment>
152130
`;
@@ -207,17 +185,6 @@ exports[`Gallery with accessibility properties renders correctly with items 1`]
207185
</div>
208186
</div>
209187
</div>
210-
<div
211-
class="widget-gallery-footer"
212-
>
213-
<div
214-
class="widget-gallery-footer-controls"
215-
>
216-
<div
217-
class="widget-gallery-fc-end"
218-
/>
219-
</div>
220-
</div>
221188
</div>
222189
</DocumentFragment>
223190
`;
@@ -256,17 +223,6 @@ exports[`Gallery with accessibility properties renders correctly without items 1
256223
</span>
257224
</div>
258225
</section>
259-
<div
260-
class="widget-gallery-footer"
261-
>
262-
<div
263-
class="widget-gallery-footer-controls"
264-
>
265-
<div
266-
class="widget-gallery-fc-end"
267-
/>
268-
</div>
269-
</div>
270226
</div>
271227
</DocumentFragment>
272228
`;
@@ -304,17 +260,6 @@ exports[`Gallery with empty option renders correctly 1`] = `
304260
</span>
305261
</div>
306262
</section>
307-
<div
308-
class="widget-gallery-footer"
309-
>
310-
<div
311-
class="widget-gallery-footer-controls"
312-
>
313-
<div
314-
class="widget-gallery-fc-end"
315-
/>
316-
</div>
317-
</div>
318263
</div>
319264
</DocumentFragment>
320265
`;
@@ -491,17 +436,6 @@ exports[`Gallery with pagination renders correctly 1`] = `
491436
</div>
492437
</div>
493438
</div>
494-
<div
495-
class="widget-gallery-footer"
496-
>
497-
<div
498-
class="widget-gallery-footer-controls"
499-
>
500-
<div
501-
class="widget-gallery-fc-end"
502-
/>
503-
</div>
504-
</div>
505439
</div>
506440
</DocumentFragment>
507441
`;
@@ -553,17 +487,6 @@ exports[`Gallery without filters renders structure without header container 1`]
553487
</div>
554488
</div>
555489
</div>
556-
<div
557-
class="widget-gallery-footer"
558-
>
559-
<div
560-
class="widget-gallery-footer-controls"
561-
>
562-
<div
563-
class="widget-gallery-fc-end"
564-
/>
565-
</div>
566-
</div>
567490
</div>
568491
</DocumentFragment>
569492
`;

0 commit comments

Comments
 (0)