Skip to content
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

Update UI on the wayfinding page #420

Merged
merged 7 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions packages/map-template/src/components/Search/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,17 +387,19 @@ function Search({ onSetSize, isOpen }) {
{isKioskContext && showLegendButton && <button className='search__legend' onClick={() => setShowLegendDialog(true)}><Legend /></button>}

{ /* Search field that allows users to search for locations (MapsIndoors Locations and external) */}

<SearchField
ref={searchFieldRef}
mapsindoors={true}
placeholder={t('Search by name, category, building...')}
results={locations => onResults(locations)}
clicked={() => searchFieldClicked()}
cleared={() => cleared()}
category={selectedCategory}
disabled={searchDisabled} // Disabled initially to prevent content jumping when clicking and changing sheet size.
/>
<label>
<span>{t('Search by name, category, building...')}</span>
<SearchField
ref={searchFieldRef}
mapsindoors={true}
placeholder={t('Search by name, category, building...')}
results={locations => onResults(locations)}
clicked={() => searchFieldClicked()}
cleared={() => cleared()}
category={selectedCategory}
disabled={searchDisabled} // Disabled initially to prevent content jumping when clicking and changing sheet size.
/>
</label>
</div>


Expand Down
4 changes: 4 additions & 0 deletions packages/map-template/src/components/Search/Search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@
padding: var(--spacing-medium) var(--spacing-x-small) var(--spacing-medium) var(--spacing-x-small);
}

span {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider targeting using a BEM element selector (&__label? 🤔 ), just to avoid problems down the line if we add a <span> in another place in the component.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point ✅

display: none;
}

}
15 changes: 7 additions & 8 deletions packages/map-template/src/components/Wayfinding/Wayfinding.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,21 +402,21 @@ function Wayfinding({ onStartDirections, onBack, directionsToLocation, direction
return (
<div className="wayfinding" ref={wayfindingRef}>
<div className="wayfinding__directions">
<div className="wayfinding__title">{t('Start wayfinding')}</div>
<div className="wayfinding__title">{t('Directions')}</div>
<button className="wayfinding__close"
onClick={() => closeWayfinding()}
aria-label="Close">
<CloseIcon />
</button>
<div className="wayfinding__locations">
<label className="wayfinding__label">
{t('From').toUpperCase()}
<label>
<span>{t('Choose departure')}</span>
<SearchField
ref={fromFieldRef}
mapsindoors={true}
google={selectedMapType === mapTypes.Google && searchExternalLocations}
mapbox={selectedMapType === mapTypes.Mapbox && searchExternalLocations}
placeholder={t('Search by name, category, building...')}
placeholder={t('Choose departure')}
results={locations => searchResultsReceived(locations, searchFieldIdentifiers.FROM)}
clicked={() => onSearchClicked(searchFieldIdentifiers.FROM)}
cleared={() => onSearchCleared(searchFieldIdentifiers.FROM)}
Expand All @@ -428,21 +428,20 @@ function Wayfinding({ onStartDirections, onBack, directionsToLocation, direction
className="wayfinding__switch">
<SwitchIcon />
</button>
<label className="wayfinding__label">
{t('To').toUpperCase()}
<label>
<span>{t('Choose destination')}</span>
<SearchField
ref={toFieldRef}
mapsindoors={true}
google={selectedMapType === mapTypes.Google && searchExternalLocations}
mapbox={selectedMapType === mapTypes.Mapbox && searchExternalLocations}
placeholder={t('Search by name, category, building...')}
placeholder={t('Choose destination')}
results={locations => searchResultsReceived(locations, searchFieldIdentifiers.TO)}
clicked={() => onSearchClicked(searchFieldIdentifiers.TO)}
cleared={() => onSearchCleared(searchFieldIdentifiers.TO)}
changed={() => onInputChanged(searchFieldIdentifiers.TO)}
/>
</label>

</div>
</div>
{!hasFoundRoute && <p className="wayfinding__error">{t('No route found')}</p>}
Expand Down
20 changes: 10 additions & 10 deletions packages/map-template/src/components/Wayfinding/Wayfinding.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.wayfinding {
color: var(--brand-colors-black-100);
display: grid;
grid-template-rows: 238px min-content;
grid-template-rows: 190px min-content;
min-height: 435px;

&__directions {
Expand Down Expand Up @@ -47,14 +47,6 @@
position: relative;
}

&__label {
display: grid;
gap: var(--spacing-x-small);
font-size: var(--font-size-small);
color: var(--color-gray-70);
font-weight: var(--font-weight-large);
}

&__use-current-position {
padding: var(--spacing-medium);
font-size: var(--font-size-medium);
Expand Down Expand Up @@ -169,7 +161,7 @@
background: transparent;
position: absolute;
right: 0;
top: 80px;
top: 40px;

&:hover {
opacity: .8;
Expand Down Expand Up @@ -207,4 +199,12 @@
background: var(--color-gray-10);
border: 1px solid var(--color-gray-30);
}

mi-search {
width: calc(100% - 48px);
}

span {
display: none;
}
}
3 changes: 3 additions & 0 deletions packages/map-template/src/i18n/da.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ const da = {
'My position': 'Min position',
'Turn on Accessibility to get directions that avoid stairs and escalators.': 'Slå "Tilgængelig rute" til for at få en rutevejledning uden trapper og rulletrapper.',
'Go!': 'Go!',
'Directions': 'Rutevejledning',
'Choose departure': 'Vælg startpunkt',
'Choose destination': 'Vælg destination',
// Venue selector
'Venues': 'Venues',
'Select venue': 'Vælg venue',
Expand Down
3 changes: 3 additions & 0 deletions packages/map-template/src/i18n/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ const de = {
'My position': 'Meine Position',
'Turn on Accessibility to get directions that avoid stairs and escalators.': 'Schalte Barrierefrei ein, um Treppen und Rolltreppen zu vermeiden.',
'Go!': 'Start!',
'Directions': 'Wegbeschreibung',
'Choose departure': 'Abfahrt wählen',
'Choose destination': 'Ziel wählen',
// Venue selector
'Venues': 'Standorte',
'Select venue': 'Wähle Standort',
Expand Down
3 changes: 3 additions & 0 deletions packages/map-template/src/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ const en = {
'My position': 'My position',
'Turn on Accessibility to get directions that avoid stairs and escalators.': 'Turn on Accessibility to get directions that avoid stairs and escalators.',
'Go!': 'Go!',
'Directions': 'Directions',
'Choose departure': 'Choose departure',
'Choose destination': 'Choose destination',
// Venue selector
'Venues': 'Venues',
'Select venue': 'Select venue',
Expand Down
3 changes: 3 additions & 0 deletions packages/map-template/src/i18n/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ const es = {
'My position': 'Mi posición',
'Turn on Accessibility to get directions that avoid stairs and escalators.': 'Active Accesibilidad para obtener indicaciones que eviten escalares y escaleras mecánicas',
'Go!': '¡Ir!',
'Directions': 'Instrucciones',
'Choose departure': 'Elige la salida',
'Choose destination': 'Elige destino',
// Venue selector
'Venues': 'Lugares',
'Select venue': 'Seleccionar lugar',
Expand Down
3 changes: 3 additions & 0 deletions packages/map-template/src/i18n/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ const fr = {
'My position': 'Ma position',
'Turn on Accessibility to get directions that avoid stairs and escalators.': 'Activez l\'accessibilité pour obtenir des itinéraires qui évitent les escaliers.',
'Go!': 'C\'est parti!',
'Directions': 'Instructions',
'Choose departure': 'Choisir le départ',
'Choose destination': 'Choisir la destination',
// Venue selector
'Venues': 'Lieux',
'Select venue': 'Sélectionner le lieu',
Expand Down
3 changes: 3 additions & 0 deletions packages/map-template/src/i18n/it.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ const it = {
'My position': 'La mia posizione',
'Turn on Accessibility to get directions that avoid stairs and escalators.': 'Attiva "Percorso accessibile" per ottenere indicazioni che evitano scale e scale mobili.',
'Go!': 'Vai!',
'Directions': 'Indicazioni',
'Choose departure': 'Scegli la partenza',
'Choose destination': 'Scegli destinazione',
// Venue selector
'Venues': 'Luoghi',
'Select venue': 'Seleziona luogo',
Expand Down
3 changes: 3 additions & 0 deletions packages/map-template/src/i18n/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ const nl = {
'My position': 'Mijn positie',
'Turn on Accessibility to get directions that avoid stairs and escalators.': 'Schakel toegankelijkheid in voor een routebeschrijving waarbij trappen en roltrappen worden vermeden',
'Go!': 'Gaan!',
'Directions': 'Richtingen',
'Choose departure': 'Kies vertrek',
'Choose destination': 'Kies bestemming',
// Venue selector
'Venues': 'Locaties',
'Select venue': 'Kies locatie',
Expand Down