Skip to content

Commit

Permalink
Merge pull request #1194 from dpc-sdp/feature/R20-2028-geolocate-label
Browse files Browse the repository at this point in the history
[R20-2028, R20-2019] Geolocate button messages and labels
  • Loading branch information
dylankelly authored May 31, 2024
2 parents e8b0266 + 87ce103 commit 78963e5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ const props = withDefaults(defineProps<Props>(), {
labels: {
submit: 'Submit',
reset: 'Reset',
placeholder: 'Enter a search term'
placeholder: 'Enter a search term',
geolocateBtn: 'Use my current location'
},
displayMapTab: false,
suggestions: {
Expand Down Expand Up @@ -507,25 +508,8 @@ const handleGeolocateSuccess = (pos: GeolocationPosition) => {
}
const handleGeolocateError = (error: GeolocationPositionError) => {

Check warning on line 510 in packages/ripple-tide-search/components/global/TideCustomCollection.vue

View workflow job for this annotation

GitHub Actions / Test

'error' is defined but never used

Check warning on line 510 in packages/ripple-tide-search/components/global/TideCustomCollection.vue

View workflow job for this annotation

GitHub Actions / Test

'error' is defined but never used
let message
switch (error.code) {
case error.PERMISSION_DENIED:
message = 'User denied the request for Geolocation.'
break
case error.POSITION_UNAVAILABLE:
message = 'Location information is unavailable.'
break
case error.TIMEOUT:
message = 'The request to get user location timed out.'
break
default:
message = 'An unknown error occurred.'
break
}
isGettingLocation.value = false
geolocationError.value = message
geolocationError.value = `We couldn't find your location. Check your browser permissions or input your location manually`
}
const locationOrGeolocation = computed(() => {
Expand Down Expand Up @@ -594,7 +578,10 @@ const locationOrGeolocation = computed(() => {
@success="handleGeolocateSuccess"
@error="handleGeolocateError"
>
Use my location
{{
searchListingConfig.labels?.geolocateBtn ||
'Use my current location'
}}
</RplMapGeolocateButton>
<div class="tide-search-refine-wrapper">
<RplSearchBarRefine
Expand Down
1 change: 1 addition & 0 deletions packages/ripple-tide-search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export type TideSearchListingConfig = {
submit: string
reset: string
placeholder: string
geolocateBtn?: string
}
/**
* @description custom sort clause
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.rpl-map-geolocate-btn {
.rpl-map-geolocate {
display: flex;
flex-direction: column;
align-items: flex-start;
}

.rpl-map-geolocate__btn {
display: inline-flex;
align-items: center;
justify-content: center;
Expand Down Expand Up @@ -31,3 +37,8 @@
cursor: not-allowed;
}
}

.rpl-map-geolocate__error {
margin-top: var(--rpl-sp-3);
margin-bottom: 0;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<div>
<div class="rpl-map-geolocate">
<button
:class="{
'rpl-map-geolocate-btn': true,
'rpl-map-geolocate__btn': true,
'rpl-u-focusable-inline': true
}"
:disabled="isBusy"
Expand All @@ -13,7 +13,11 @@
<slot> Use my current location </slot>
</span>
</button>
<RplFormValidationError v-if="error" :message="error" />
<RplFormValidationError
v-if="error"
class="rpl-map-geolocate__error"
:message="error"
/>
</div>
</template>
<script setup lang="ts">
Expand Down

0 comments on commit 78963e5

Please sign in to comment.