-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix mobile location tab #1106
base: main
Are you sure you want to change the base?
Fix mobile location tab #1106
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,35 @@ | ||||||||||
import React, { useCallback } from 'react'; | ||||||||||
import { Link } from 'react-router-dom'; | ||||||||||
import { useMediaQuery } from '@mui/material'; | ||||||||||
import { MOBILE_BREAKPOINT } from '../../globals'; | ||||||||||
|
||||||||||
interface MapLinkProps { | ||||||||||
buildingId: number; | ||||||||||
room: string; | ||||||||||
isDark: boolean; | ||||||||||
setActiveTab: (tab: number) => void; | ||||||||||
} | ||||||||||
|
||||||||||
const MapLink: React.FC<MapLinkProps> = ({ buildingId, room, isDark, setActiveTab }) => { | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
chore: consistency in how we type components There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
chore: prefer named exports |
||||||||||
|
||||||||||
const isMobileScreen = useMediaQuery(`(max-width: ${MOBILE_BREAKPOINT})`); | ||||||||||
|
||||||||||
const focusMap = useCallback(() => { | ||||||||||
setActiveTab(isMobileScreen ? 3 : 2); | ||||||||||
}, [isMobileScreen, setActiveTab]); | ||||||||||
|
||||||||||
return ( | ||||||||||
<Link | ||||||||||
to={`/map?location=${buildingId}`} | ||||||||||
onClick={focusMap} | ||||||||||
style={{ | ||||||||||
textDecoration: 'none', | ||||||||||
color: isDark ? 'dodgerblue' : 'blue', | ||||||||||
}} | ||||||||||
> | ||||||||||
{room} | ||||||||||
</Link> | ||||||||||
); | ||||||||||
}; | ||||||||||
|
||||||||||
export default MapLink; | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
chore (repeat): prefer named exports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue:
MapLink
should directly call the stores, rather than having them passed in as props