Skip to content

Commit 0fdb44d

Browse files
committed
refactor: change the direction gallery thumbnails are rendered
This applies to grids of 2x2 images. Currently, we render images by column. This means that the first two pictures are in column one, the last two in column two. To conform to what the other SDKs does, this PR flips in by changing `invertedDirection` to `true` for our use of `buildThumbnailGallery`. This will render the photos by row instead.
1 parent a5ff69d commit 0fdb44d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

package/src/components/Attachment/__tests__/Gallery.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,13 @@ describe('Gallery', () => {
248248
const { queryAllByTestId } = render(component);
249249

250250
await waitFor(() => {
251-
expect(queryAllByTestId('gallery-column-0').length).toBe(1);
252-
expect(queryAllByTestId('gallery-column-1').length).toBe(1);
251+
expect(queryAllByTestId('gallery-row-0').length).toBe(1);
252+
expect(queryAllByTestId('gallery-row-1').length).toBe(1);
253253

254-
expect(queryAllByTestId('gallery-column-0-item-0').length).toBe(1);
255-
expect(queryAllByTestId('gallery-column-0-item-1').length).toBe(1);
256-
expect(queryAllByTestId('gallery-column-1-item-0').length).toBe(1);
257-
expect(queryAllByTestId('gallery-column-1-item-1').length).toBe(1);
254+
expect(queryAllByTestId('gallery-row-0-item-0').length).toBe(1);
255+
expect(queryAllByTestId('gallery-row-0-item-1').length).toBe(1);
256+
expect(queryAllByTestId('gallery-row-1-item-0').length).toBe(1);
257+
expect(queryAllByTestId('gallery-row-1-item-1').length).toBe(1);
258258
});
259259
});
260260

package/src/components/Attachment/utils/buildGallery/buildGallery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export function buildGallery<
7171
[1, 1],
7272
],
7373
images: images.slice(0, 4),
74-
invertedDirections: false,
74+
invertedDirections: true,
7575
sizeConfig,
7676
});
7777
}

0 commit comments

Comments
 (0)