Skip to content

Commit 21376eb

Browse files
committed
chore: apply review feedback
1 parent 9ef25b1 commit 21376eb

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const Container = observer(function GalleryContainer(props: GalleryContainerProp
9090
itemEventsController={itemEventsController}
9191
focusController={focusController}
9292
getPosition={getPositionCallback}
93+
loadMoreButtonCaption={props.loadMoreButtonCaption?.value}
9394
/>
9495
);
9596
});

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ export interface GalleryProps<T extends ObjectItem> {
5050
itemHelper: GalleryItemHelper;
5151
selectHelper: SelectActionHandler;
5252
getPosition: (index: number) => PositionInGrid;
53+
loadMoreButtonCaption?: string;
5354
}
5455

5556
export function Gallery<T extends ObjectItem>(props: GalleryProps<T>): ReactElement {
57+
const { loadMoreButtonCaption = "Load more" } = props;
5658
const pagination = props.paging ? (
5759
<div className="widget-gallery-pagination">
5860
<Pagination
@@ -122,9 +124,9 @@ export function Gallery<T extends ObjectItem>(props: GalleryProps<T>): ReactElem
122124
{showBottomPagination && pagination}
123125
<div className="widget-gallery-load-more">
124126
{props.preview && props.paginationType === "loadMore" && (
125-
<LoadMorePreview>Load more</LoadMorePreview>
127+
<LoadMorePreview>{loadMoreButtonCaption}</LoadMorePreview>
126128
)}
127-
{!props.preview && <LoadMore>Load more</LoadMore>}
129+
{!props.preview && <LoadMore>{loadMoreButtonCaption}</LoadMore>}
128130
</div>
129131
</GalleryFooter>
130132
</GalleryRoot>

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import { createElement } from "react";
44
import { useGalleryRootScope } from "src/helpers/root-context";
55

66
export function LoadMoreButton(props: JSX.IntrinsicElements["button"]): React.ReactNode {
7-
return <button {...props} className={cn("btn btn-primary widget-gallery-load-more-btn", props.className)}></button>;
7+
return (
8+
<button {...props} className={cn("btn btn-primary widget-gallery-load-more-btn", props.className)}>
9+
{props.children}
10+
</button>
11+
);
812
}
913

1014
export const LoadMore = observer(function LoadMore(props: { children: React.ReactNode }): React.ReactNode {

0 commit comments

Comments
 (0)