Skip to content

Commit

Permalink
feat: add back button to mobile location screen
Browse files Browse the repository at this point in the history
  • Loading branch information
amy-corson-ibigroup committed Dec 6, 2023
1 parent 40f3a50 commit 64eb62f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/components/mobile/location-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ import React, { Component } from 'react'
import styled from 'styled-components'

import * as uiActions from '../../actions/ui'
import { ChevronLeft } from '@styled-icons/fa-solid'

import { MobileScreens } from '../../actions/ui-constants'
import LocationField from '../form/connected-location-field'

import { StyledIconWrapper } from '../util/styledIcon'

import MobileContainer from './container'
import MobileNavigationBar from './navigation-bar'

Expand All @@ -27,6 +31,14 @@ const MobileLocationField = styled(LocationField)`
}
`

const MobileLocationBackButton = styled.button`
background: white;
border: none;
position: absolute;
z-index: 100;
margin-top: 4px;
`

class MobileLocationSearch extends Component {
static propTypes = {
backScreen: PropTypes.number,
Expand All @@ -46,6 +58,10 @@ class MobileLocationSearch extends Component {
this.props
const suppressNearby =
otherLocation && otherLocation.category === 'CURRENT_LOCATION'

const backButtonText = intl.formatMessage({
id: 'components.BackToTripPlanner.backToTripPlanner'
})
return (
<MobileContainer>
<MobileNavigationBar
Expand All @@ -62,6 +78,18 @@ class MobileLocationSearch extends Component {
/>
<main tabIndex={-1}>
<div className="location-search mobile-padding">
<MobileLocationBackButton
aria-label={backButtonText}
onClick={() =>
this.props.setMobileScreen(MobileScreens.SEARCH_FORM)

Check failure on line 84 in lib/components/mobile/location-search.js

View workflow job for this annotation

GitHub Actions / test-build-release

Unexpected newline before '}'
}
title={backButtonText}
>
<StyledIconWrapper>
<ChevronLeft />
</StyledIconWrapper>
</MobileLocationBackButton>

<MobileLocationField
hideExistingValue
inputPlaceholder={
Expand Down

0 comments on commit 64eb62f

Please sign in to comment.