-
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
Collapsible Legs in Route Overview screen #314
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.Itinerary { | ||
padding: 32px 32px; | ||
padding: 32px 20px; | ||
} | ||
|
||
.Itinerary_overallTimeHeading { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,22 +2,27 @@ import * as React from 'react'; | |
import { FormattedMessage, useIntl } from 'react-intl'; | ||
import { BIKEHOPPER_THEME_COLOR } from '../lib/colors'; | ||
import formatDistance from '../lib/formatDistance'; | ||
import formatMajorStreets from '../lib/formatMajorStreets'; | ||
import { describeBikeInfra } from '../lib/geometry'; | ||
import { formatDurationBetween } from '../lib/time'; | ||
import InstructionSigns from '../lib/InstructionSigns'; | ||
import useScrollToRef from '../hooks/useScrollToRef'; | ||
import ItineraryBikeStep from './ItineraryBikeStep'; | ||
import ItineraryHeader from './ItineraryHeader'; | ||
import ItineraryDivider from './ItineraryDivider'; | ||
import ItinerarySpacer from './ItinerarySpacer'; | ||
|
||
import { ReactComponent as BikeIcon } from 'iconoir/icons/bicycle.svg'; | ||
import ItineraryElevationProfile from './ItineraryElevationProfile'; | ||
|
||
export default function ItineraryBikeLeg({ | ||
leg, | ||
legDestination, | ||
isOnlyLeg, | ||
expanded, | ||
onStepClick, | ||
onToggleLegExpand, | ||
scrollToStep, | ||
displayLegElevation, | ||
}) { | ||
const intl = useIntl(); | ||
const instructionsWithBikeInfra = React.useMemo(() => { | ||
|
@@ -63,6 +68,9 @@ export default function ItineraryBikeLeg({ | |
icon={bikeIcon} | ||
iconColor={BIKEHOPPER_THEME_COLOR} | ||
alerts={alerts} | ||
expanded={expanded} | ||
alertsExpanded={true} | ||
onToggleLegExpand={onToggleLegExpand} | ||
> | ||
<span> | ||
<FormattedMessage | ||
|
@@ -75,32 +83,40 @@ export default function ItineraryBikeLeg({ | |
{formatDistance(leg.distance, intl)} | ||
{spacer} | ||
{formatDurationBetween(leg.departure_time, leg.arrival_time, intl)} | ||
{spacer} | ||
{formatMajorStreets(leg)} | ||
</span> | ||
</ItineraryHeader> | ||
<ItineraryDivider /> | ||
{instructionsWithBikeInfra.map((step, stepIdx) => | ||
isArriveStep(step) | ||
? null | ||
: [ | ||
<ItineraryBikeStep | ||
key={stepIdx} | ||
step={step} | ||
isFirstStep={stepIdx === 0} | ||
onClick={onStepClick.bind(null, stepIdx)} | ||
rootRef={stepIdx === scrollToStep ? scrollToRef : null} | ||
/>, | ||
<ItineraryDivider | ||
key={stepIdx + 'd'} | ||
transit={false} | ||
detail={`${ | ||
step.distance ? formatDistance(step.distance, intl) : null | ||
}`} | ||
> | ||
{step.bikeInfra} | ||
</ItineraryDivider>, | ||
], | ||
|
||
{expanded ? ( | ||
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. try to flatten this |
||
<div onClick={onToggleLegExpand}> | ||
<ItinerarySpacer /> | ||
|
||
{isOnlyLeg || !displayLegElevation ? null : ( | ||
<ItineraryElevationProfile route={{ legs: [leg] }} /> | ||
)} | ||
|
||
{instructionsWithBikeInfra.map((step, stepIdx) => | ||
isArriveStep(step) | ||
? null | ||
: [ | ||
<ItineraryBikeStep | ||
key={stepIdx} | ||
step={step} | ||
distance={ | ||
step.distance ? formatDistance(step.distance, intl) : null | ||
} | ||
infra={step.bikeInfra} | ||
isFirstStep={stepIdx === 0} | ||
onClick={onStepClick.bind(null, stepIdx)} | ||
rootRef={stepIdx === scrollToStep ? scrollToRef : null} | ||
/>, | ||
], | ||
)} | ||
</div> | ||
) : ( | ||
<ItinerarySpacer /> | ||
)} | ||
<ItinerarySpacer /> | ||
</> | ||
); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.ItineraryBikeStep_content { | ||
margin-bottom: 15px; | ||
} | ||
|
||
.ItineraryBikeStep_infra { | ||
color: #438601; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,9 @@ | |
|
||
.ItineraryHeader_iconContainer { | ||
display: inline-flex; | ||
width: 60px; | ||
height: 60px; | ||
border-radius: 30px; | ||
width: 36px; | ||
height: 36px; | ||
border-radius: 18px; | ||
text-align: center; | ||
flex-direction: column; | ||
justify-content: space-around; | ||
|
@@ -21,35 +21,50 @@ | |
|
||
.ItineraryHeader_icon { | ||
top: 0; | ||
width: 32px; | ||
height: 32px; | ||
width: 20px; | ||
height: 20px; | ||
} | ||
|
||
.ItineraryHeader_headerRow { | ||
display: flex; | ||
} | ||
|
||
.ItineraryHeader_header { | ||
font-size: 20px; | ||
font-weight: bold; | ||
font-size: 17px; | ||
font-weight: 500; | ||
margin: 0; | ||
} | ||
|
||
.ItineraryHeader_subheading { | ||
font-weight: normal; | ||
font-size: 16px; | ||
margin: 8px 0; | ||
font-size: 14px; | ||
margin: 2px 0 0 0; | ||
opacity: 0.6; | ||
} | ||
|
||
.ItineraryHeader_alerts { | ||
background-color: #fffbca; | ||
background-color: #fff5c0; | ||
padding: 8px; | ||
margin: 0; | ||
margin: 8px 0 0 0; | ||
list-style-type: none; | ||
border: 1px solid rgb(187, 187, 187); | ||
border: 1px solid #f4d598; | ||
Comment on lines
+46
to
+50
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 are gradually migrating toward using Tailwind CSS and it might be an opportunity if changing the styles a lot to convert these components over. Also, can we grab a color from Tailwind's palette for these? I've been using the Tailwind palette for minor UI stuff. Or if we want to use a custom color, it would be nice to define these new colors globally in tailwind.config.js so we can use them consistently |
||
border-radius: 4px; | ||
font-size: 14px; | ||
} | ||
|
||
.ItineraryHeader_alertIcon { | ||
margin-right: 4px; | ||
position: relative; | ||
top: 4px; | ||
width: 16px; | ||
height: 16px; | ||
display: inline-block; | ||
vertical-align: top; | ||
} | ||
|
||
.ItineraryHeader_alertIcon svg { | ||
width: 16px; | ||
height: 16px; | ||
} | ||
|
||
.ItineraryHeader_alertHeader { | ||
|
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.
don't hide these by default: figure out better solution