Skip to content

swipe media cards on small screen#411

Open
interim17 wants to merge 16 commits intomainfrom
feature/image-swipe
Open

swipe media cards on small screen#411
interim17 wants to merge 16 commits intomainfrom
feature/image-swipe

Conversation

@interim17
Copy link
Contributor

@interim17 interim17 commented Jan 14, 2026

Problem

Solution

  • New feature (non-breaking change which adds functionality)

Screenshots (optional):

Screenshot 2026-01-13 at 4 09 48 PM Screenshot 2026-01-13 at 4 09 39 PM

Comment on lines +23 to +31
export const PreviewGroup = ({
currentIndex,
imageItems,
mediaItems,
previewVisible,
setCurrentIndex,
setPreviewVisible,
setSelectedMedia,
}: ImagePreviewGroupProps) => {
Copy link
Contributor Author

@interim17 interim17 Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from ImagesAndVideos

Strictly speaking this component doesn't get re-used so doesn't deserve to be a component, but I was trying to reduce line count and separate concerns in ImagesAndVideo it does get rendered in two places, but is the same in both.

Comment on lines +17 to +18
import { PreviewGroup } from "./ImagePreviewGroup";
import { MediaCard } from "./MediaCard";
Copy link
Contributor Author

@interim17 interim17 Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled the preview component, and MediaCard (along with renderMediaItems() into separate files to make this a little less intimidating to read.

@interim17 interim17 marked this pull request as ready for review January 20, 2026 20:52
@interim17 interim17 requested a review from Copilot January 20, 2026 22:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements swipable media cards for small screens by refactoring the ImagesAndVideos component into a more modular structure. The changes introduce responsive behavior that displays media in a horizontally scrollable card layout on tablet and mobile devices, while maintaining the original layout for larger screens.

Changes:

  • Refactored ImagesAndVideos component into separate, focused modules (MediaCard, ImagePreviewGroup, and main component)
  • Added responsive swipable card layout for tablet/mobile viewports with scroll-snap behavior
  • Updated padding and styling to support the new mobile card experience

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/templates/disease-cell-line.tsx Updated import path to reflect new component directory structure
src/templates/cell-line.tsx Updated import path to reflect new component directory structure
src/style/layout.module.css Changed content padding from 0 to 8px on small screens
src/style/index.sass Added global overscroll prevention for vertical scrolling
src/style/images-and-videos.module.css Added extensive mobile/tablet styling for swipable cards and updated media query breakpoints
src/components/ImagesAndVideos.tsx Removed entire file as part of refactoring into modular components
src/components/ImagesAndVideo/MediaCard.tsx New component handling individual media card rendering
src/components/ImagesAndVideo/ImagesAndVideos.tsx New main component with responsive layout logic
src/components/ImagesAndVideo/ImagePreviewGroup.tsx New component handling image preview functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gap: 20px;
overflow-x: auto;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;

This comment was marked as resolved.

videoIframe,
} = require("../../style/images-and-videos.module.css");

interface MobileImageCardProps {

This comment was marked as resolved.

Comment on lines 163 to 170
{mediaItems.map((_item, index) => (
<MediaCard
className={mobileMediaCard}
key={index}
index={index}
title={title}
isMobile={isMobile}
item={mediaItems[index]}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _item parameter is unused (indicated by the underscore prefix) but then mediaItems[index] is accessed on line 170. Consider removing the underscore and using the item parameter directly instead of re-accessing the array by index.

Suggested change
{mediaItems.map((_item, index) => (
<MediaCard
className={mobileMediaCard}
key={index}
index={index}
title={title}
isMobile={isMobile}
item={mediaItems[index]}
{mediaItems.map((item, index) => (
<MediaCard
className={mobileMediaCard}
key={index}
index={index}
title={title}
isMobile={isMobile}
item={item}

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read this and took a stab at it and found it buggy, but I'll try again.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what was buggy about it? it should be the exact some item right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk what I did last time but it worked this time! Pushed this a couple days agio:
ef492c5

Base automatically changed from fix/tab-swipe to main January 21, 2026 22:53
Copy link

@TravisKroeker TravisKroeker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving in anticipation of merging the changes we discussed

@netlify
Copy link

netlify bot commented Jan 22, 2026

Deploy Preview for cell-catalog ready!

Name Link
🔨 Latest commit 5c3a99a
🔍 Latest deploy log https://app.netlify.com/projects/cell-catalog/deploys/698298bbea6494000817ceb2
😎 Deploy Preview https://deploy-preview-411--cell-catalog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@interim17 interim17 requested review from meganrm and rugeli January 22, 2026 21:08
@meganrm
Copy link
Collaborator

meganrm commented Jan 26, 2026

@interim17: checking on this: the description still says "DRAFT" and Travis seems to have asked for changes. Are those things both addressed?

@interim17
Copy link
Contributor Author

@meganrm yes and those changes were merged

Comment on lines 51 to 52
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a nice encapsulation

Comment on lines 124 to 126
{parentalGeneSymbol
? `${geneSymbol} in WTC-${fluorescentTag}-${parentalGeneSymbol} (${alleleTag}-allelic tag)`
: `${geneSymbol} in WTC-${fluorescentTag} (${alleleTag}-allelic tag)`}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is how we had this before, but it looks like something that could be a formatting function instead of inline like this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy to make one, I think it feels a bit odd to pass that many props to a util so I'm going to define the util above the render in this file.

Copy link
Collaborator

@meganrm meganrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few small issues otherwise, looks good

@interim17 interim17 requested a review from meganrm February 3, 2026 20:18
Comment on lines +169 to +172
className={classNames(
mobileMediaCard,
mediaItems.length === 1 && singleImage,
)}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last commit added a couples rules to center and fill the space if there is only one image, it looked funny offset to the left

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants