Skip to content

Conversation

@interim17
Copy link
Contributor

Problem

Makes subpage tab buttons swipe on tablets and mobile.

Solution

Its fairly simple, most just relies on overflow:auto which works and relies on current styling. Carousel from antd seemed like a hassle?

As a utility i wrapped the window width hook in a boolean return that checks breakpoints and defined a tablet and mobile hook, so far that's all we use useWindowWidth for, so we can just call useTabletBreakpoint() or useMobileBreakpoint where needed. If we need to compare those values we can build on the idea.

Added two lines in layout CSS module to prevent swiping from exposing components that are larger than the page, and to reduce margins.

@interim17
Copy link
Contributor Author

@meganrm @rugeli Netlify is failing to initialize and install dependencies, but the build is fine. Builds and runs fine for me locally.

This PR doesn't touch any dependencies though. Could this have anything to do with the changes to yarn vs npm in the recently merged workflow PR?

@interim17 interim17 requested review from meganrm and rugeli January 10, 2026 01:07
@meganrm
Copy link
Collaborator

meganrm commented Jan 10, 2026

@meganrm @rugeli Netlify is failing to initialize and install dependencies, but the build is fine. Builds and runs fine for me locally.

This PR doesn't touch any dependencies though. Could this have anything to do with the changes to yarn vs npm in the recently merged workflow PR?

I pulled main into my branches after that merge and they ran the actions without any problems. I can't tell why this is failing at the moment. I'm triggering a re-build just to see if it's a fluke

Comment on lines +1 to +14
import { PHONE_BREAKPOINT, TABLET_BREAKPOINT } from "../constants";
import useWindowWidth from "./useWindowWidth";

export const useMaxWidthBreakpoint = (
breakpoint: number
): boolean => {
const windowWidth = useWindowWidth();
return windowWidth < breakpoint
};

export const useMobileBreakpoint = () => useMaxWidthBreakpoint(PHONE_BREAKPOINT);
export const useTabletBreakpoint = () => useMaxWidthBreakpoint(TABLET_BREAKPOINT);

export default useMaxWidthBreakpoint;
Copy link
Contributor Author

@interim17 interim17 Jan 12, 2026

Choose a reason for hiding this comment

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

This is how we are using the window width hook in most places, so might as well just make these available like this?

Could add some complexity to use different comparators if desired?

Copy link
Collaborator

Choose a reason for hiding this comment

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

love this util! only a minor thought: foldable phones might behave a bit differently, but that feels out of scope for now

I don’t see a preview QR code in the comments, but it should show up once this is pulled or merged into main. I’d also like to check orientation changes (e.g. vertical to horizontal) when we get a chance

Comment on lines +81 to +98
<div className={container}>
<div className={mobileTabBar}>
{tabsToRender.map((tabName) => (
<button
key={tabName}
className={`${mobileTabButton} ${
activeTab === tabName
? mobileTabButtonActive
: ""
}`}
onClick={() => setActiveTab(tabName)}
>
{renderTabLabel(tabName)}
</button>
))}
</div>
{tabComponents[activeTab]}
</div>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the swiping version, I think it's small enough to justify leaving here in this component?

@interim17 interim17 marked this pull request as ready for review January 12, 2026 17:38
Comment on lines +68 to 77
const renderTabLabel = (tabName: SubPage) => {
const label = tabName.split(" ").map((word) => {
return <span key={word}>{word}</span>;
});
return (
<Flex wrap justify="center" align="center" className={labelGroup}>
{label}
</Flex>
);
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

couldn't this be accomplished through CSS? what's the reason for this approach ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the same approach that was in the code before just factored out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you're asking why we are splitting the word into separate spans i don't actually remember how we landed at that approach, we can refactor if you want?

Copy link
Collaborator

Choose a reason for hiding this comment

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

that's a good enough answer, just curious

@netlify
Copy link

netlify bot commented Jan 21, 2026

Deploy Preview for cell-catalog ready!

Name Link
🔨 Latest commit f3f8443
🔍 Latest deploy log https://app.netlify.com/projects/cell-catalog/deploys/6971583c05db780008d27064
😎 Deploy Preview https://deploy-preview-409--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 merged commit c0cdcec into main Jan 21, 2026
6 checks passed
@interim17 interim17 deleted the fix/tab-swipe branch January 21, 2026 22:53
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