-
Notifications
You must be signed in to change notification settings - Fork 2
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
Desktop Layout [WIP] #398
base: main
Are you sure you want to change the base?
Desktop Layout [WIP] #398
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.DesktopMapLayout { | ||
overflow: hidden; | ||
display: flex; | ||
width: 100%; | ||
height: 100%; | ||
flex-flow: row nowrap; | ||
} | ||
|
||
.DesktopMapLayout_sidebar { | ||
display: flex; | ||
flex-basis: 400px; | ||
height: 100%; | ||
overflow-y: scroll; | ||
flex-direction: column; | ||
} | ||
|
||
.DesktopMapLayout_map { | ||
display: flex; | ||
flex-grow: 1; | ||
height: 100%; | ||
overflow: hidden; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { MapRefs } from '../hooks/useMapRefs'; | ||
import { HtmlPortalNode, OutPortal } from 'react-reverse-portal'; | ||
|
||
type Props = { | ||
header: JSX.Element; | ||
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. Interesting, I elsewhere use |
||
infoBox?: JSX.Element; | ||
mapRefs: MapRefs; | ||
mapPortal: HtmlPortalNode; | ||
}; | ||
|
||
import './DesktopMapLayout.css'; | ||
import useIsMobile from '../hooks/useIsMobile'; | ||
import { useEffect } from 'react'; | ||
|
||
export default function DesktopMapLayout({ | ||
header, | ||
infoBox, | ||
mapRefs, | ||
mapPortal, | ||
}: Props) { | ||
const hideMap = false; | ||
|
||
const isMobile = useIsMobile(); | ||
|
||
const { | ||
mapRef, | ||
mapControlBottomLeftRef, | ||
mapControlBottomRightRef, | ||
mapControlTopLeftRef, | ||
mapControlTopRightRef, | ||
} = mapRefs; | ||
|
||
const updateMapTopControls = () => { | ||
if ( | ||
!mapRef.current || | ||
!mapControlTopLeftRef.current || | ||
!mapControlTopRightRef.current | ||
) { | ||
return; | ||
} | ||
|
||
mapControlTopLeftRef.current.style.transform = 'translate3d(0,0,0)'; | ||
mapControlTopRightRef.current.style.transform = 'translate3d(0,0,0)'; | ||
}; | ||
|
||
useEffect(() => { | ||
if (!isMobile) { | ||
console.log('now Desktop'); | ||
updateMapTopControls(); | ||
} | ||
return () => console.log('no longer Desktop'); | ||
}, [isMobile]); | ||
|
||
return ( | ||
<div className="DesktopMapLayout"> | ||
<div className="DesktopMapLayout_sidebar"> | ||
{header} | ||
{infoBox} | ||
</div> | ||
<div className="DesktopMapLayout_map"> | ||
<OutPortal node={mapPortal} isMobile={false} /> | ||
</div> | ||
</div> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,16 +72,6 @@ export default function DirectionsNullState(props: Props) { | |
/> | ||
</p> | ||
)} | ||
<p className="hidden lg:block"> | ||
<FormattedMessage | ||
defaultMessage={ | ||
'In this early beta, BikeHopper is <strong>designed for phone screens</strong>,' + | ||
' so it might look strange on your computer.' | ||
} | ||
description="paragraph in welcome screen" | ||
values={{ strong }} | ||
/> | ||
</p> | ||
<p> | ||
<FormattedMessage | ||
defaultMessage={ | ||
|
@@ -112,7 +102,7 @@ export default function DirectionsNullState(props: Props) { | |
values={{ | ||
link: (chunks) => ( | ||
<a | ||
href="https://github.com/bikehopper/bikehopper-ui" | ||
href="https://github.com/bikehopper/" | ||
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. prefer to keep this pointed at I'm aware it's been argued that that isn't the correct place for an overview to live. however, currently it's the only public overview we have. 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. i will make a more suitable public overview repo/page before merging this PR |
||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.ItineraryElevation__chart { | ||
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. Per coding conventions please use Tailwind for new components |
||
display: flex; | ||
overflow: hidden; | ||
} |
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.
Why does this type not match the overlayRef type in src/hooks/useMapRefs? (This type is not nullable, and could be any HTML element, not just a div.)