Skip to content

Commit 7c63699

Browse files
committed
fix: center the gallery image
Signed-off-by: Innei <[email protected]>
1 parent cab78d8 commit 7c63699

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/components/ui/gallery/Gallery.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,19 @@ export const Gallery: FC<GalleryProps> = (props) => {
143143
<div
144144
className={clsx('w-full', 'relative', styles['root'])}
145145
ref={ref}
146+
onTouchMove={handleCancelAutoplay}
146147
onWheel={handleCancelAutoplay}
147-
onTouchStart={handleCancelAutoplay}
148148
>
149149
<div
150150
className={clsx(
151151
'w-full overflow-auto whitespace-nowrap',
152152
styles['container'],
153153
)}
154-
ref={setContainerRef}
154+
onTouchStart={handleCancelAutoplay}
155155
onScroll={handleOnScroll}
156+
ref={setContainerRef}
157+
onTouchMove={handleCancelAutoplay}
158+
onWheel={handleCancelAutoplay}
156159
>
157160
{images.map((image) => {
158161
return <GalleryItem key={image.url} image={image} />
@@ -198,7 +201,7 @@ const GalleryItem: FC<{
198201
return (
199202
<div
200203
style={childStyle}
201-
className={clsx(styles['child'], 'inline-block')}
204+
className={clsx(styles['child'], 'inline-block self-center')}
202205
key={`${image.url}-${image.name || ''}`}
203206
>
204207
<FixedZoomedImage
@@ -210,3 +213,5 @@ const GalleryItem: FC<{
210213
</div>
211214
)
212215
})
216+
217+
GalleryItem.displayName = 'GalleryItem'

0 commit comments

Comments
 (0)