-
Notifications
You must be signed in to change notification settings - Fork 96
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
feat: add to single line map arrowa to navigate between points #798
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,9 @@ | ||
.map-footer-buttons { | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
.disabled { | ||
pointer-events: none; | ||
opacity: 0.5; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { LeftOutlined, RightOutlined } from '@ant-design/icons' | ||
import { Point } from 'src/pages/timeBasedMap' | ||
import './MapFooterButtons.scss' | ||
|
||
type TMapFooterButtons = { | ||
index: number | ||
positions: Point[] | ||
navigateMarkers: (id: number) => void | ||
} | ||
|
||
function MapFooterButtons({ index, positions, navigateMarkers }: TMapFooterButtons) { | ||
const rightStep = index + 1 | ||
const leftStep = index - 1 | ||
|
||
const checkIfValidStep = (i: number) => { | ||
return Boolean(positions.at(i)) | ||
} | ||
|
||
return ( | ||
<div className="map-footer-buttons"> | ||
<RightOutlined | ||
title={'right-chevron'} | ||
className={`${checkIfValidStep(rightStep) ? '' : 'disabled'}`} | ||
onClick={() => navigateMarkers(rightStep)} | ||
/> | ||
<LeftOutlined | ||
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. we can add a "title" attribute for hover ("prev" / "next") 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. 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. the title attribute is visible to users, and should help them understand whether right will indicate the previous or the next item of the list. |
||
title={'left-chevron'} | ||
className={`${checkIfValidStep(leftStep) ? '' : 'disabled'}`} | ||
onClick={() => navigateMarkers(leftStep)} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
export default MapFooterButtons |
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.
just an idea - we can hide the button if it's not relevant for this data point