Skip to content

Commit 167c03f

Browse files
harshini-mageshdannyphan2000
authored andcommitted
@W-18958060: Fit and Finish (#2981)
Modified dropdown to follow Figma design Signed-off-by: harshini-magesh <harshini.magesh@salesforce.com>
1 parent a662c6b commit 167c03f

File tree

7 files changed

+90
-68
lines changed

7 files changed

+90
-68
lines changed

packages/template-retail-react-app/app/components/address-suggestion-dropdown/index.jsx

Lines changed: 58 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@
66
*/
77
import React, {useEffect, useRef} from 'react'
88
import PropTypes from 'prop-types'
9+
import {FormattedMessage} from 'react-intl'
10+
import {getAssetUrl} from '@salesforce/pwa-kit-react-sdk/ssr/universal/utils'
911
import {
1012
Box,
1113
Flex,
1214
Text,
1315
IconButton,
14-
Spinner
16+
Spinner,
17+
Stack,
18+
Spacer
1519
} from '@salesforce/retail-react-app/app/components/shared/ui'
16-
import {CloseIcon} from '@salesforce/retail-react-app/app/components/icons'
20+
import {CloseIcon, LocationIcon} from '@salesforce/retail-react-app/app/components/icons'
1721

1822
/**
1923
* Address Suggestion Dropdown Component
@@ -88,82 +92,68 @@ const AddressSuggestionDropdown = ({
8892
borderRadius="md"
8993
boxShadow="md"
9094
mt={1}
91-
maxH="300px"
92-
overflowY="auto"
9395
>
94-
<Flex
95-
px={4}
96-
py={2}
97-
borderBottom="1px solid"
98-
borderColor="gray.200"
99-
justifyContent="space-between"
100-
alignItems="center"
101-
>
96+
<Flex px={4} pr={0} py={2} alignItems="center">
10297
<Text fontSize="sm" fontWeight="medium" color="gray.600">
103-
Suggested
98+
<FormattedMessage
99+
defaultMessage="SUGGESTED"
100+
id="addressSuggestionDropdown.suggested"
101+
/>
104102
</Text>
103+
<Spacer />
105104
<IconButton
106-
aria-label="Close suggestions"
107-
icon={<CloseIcon />}
108-
variant="ghost"
109105
size="sm"
106+
variant="ghost"
107+
icon={<CloseIcon boxSize={4} color="gray.600" />}
110108
onClick={onClose}
109+
aria-label="Close suggestions"
111110
/>
112111
</Flex>
113-
{suggestions.map((suggestion, index) => (
114-
<Box
115-
key={index}
116-
px={4}
117-
py={2}
118-
cursor="pointer"
119-
_hover={{bg: 'gray.50'}}
120-
onClick={() => onSelectSuggestion(suggestion)}
121-
role="button"
122-
tabIndex={0}
123-
onKeyDown={(e) => {
124-
if (e.key === 'Enter' || e.key === ' ') {
125-
onSelectSuggestion(suggestion)
126-
}
127-
}}
128-
>
129-
<Flex alignItems="center" gap={2}>
130-
{/* Location Marker */}
131-
<Box position="relative" w={4} h={4}>
132-
<Box
133-
position="absolute"
134-
top={0}
135-
left={0}
136-
w={4}
137-
h={4}
138-
bg="blue.500"
139-
borderRadius="full"
140-
opacity={0.2}
141-
/>
142-
<Box
143-
position="absolute"
144-
top={1}
145-
left={1}
146-
w={2}
147-
h={2}
148-
bg="blue.500"
149-
borderRadius="full"
150-
/>
151-
</Box>
112+
<Stack spacing={0}>
113+
{suggestions.map((suggestion, index) => (
114+
<Box
115+
key={index}
116+
px={4}
117+
py={3}
118+
cursor="pointer"
119+
_hover={{bg: 'gray.50'}}
120+
onClick={() => onSelectSuggestion(suggestion)}
121+
role="button"
122+
tabIndex={0}
123+
onKeyDown={(e) => {
124+
if (e.key === 'Enter' || e.key === ' ') {
125+
onSelectSuggestion(suggestion)
126+
}
127+
}}
128+
>
129+
<Flex alignItems="center" gap={2}>
130+
{/* Location Icon */}
131+
<LocationIcon boxSize={4} color="black" />
152132

153-
{/* Address Text */}
154-
<Box flex={1}>
155-
<Text fontSize="sm" noOfLines={1}>
156-
{suggestion.structured_formatting?.main_text}
157-
</Text>
158-
{suggestion.structured_formatting?.secondary_text && (
159-
<Text fontSize="xs" color="gray.500" noOfLines={1}>
160-
{suggestion.structured_formatting.secondary_text}
133+
{/* Address Text */}
134+
<Box flex={1}>
135+
<Text fontSize="sm" noOfLines={1}>
136+
{suggestion.description || `${suggestion.structured_formatting?.main_text}, ${suggestion.structured_formatting?.secondary_text}`}
161137
</Text>
162-
)}
163-
</Box>
164-
</Flex>
165-
</Box>
166-
))}
138+
</Box>
139+
</Flex>
140+
</Box>
141+
))}
142+
</Stack>
143+
144+
{/* Google Maps Attribution */}
145+
<Box
146+
px={4}
147+
py={3}
148+
display="flex"
149+
alignItems="center"
150+
>
151+
<img
152+
src={getAssetUrl('static/img/GoogleMaps_Logo_Gray_4x.png')}
153+
alt="Google Maps"
154+
style={{ width: '98px', height: '18px' }}
155+
/>
156+
</Box>
167157
</Box>
168158
)
169159
}
5.02 KB
Loading

packages/template-retail-react-app/app/static/translations/compiled/en-GB.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@
355355
"value": "You Might Also Like"
356356
}
357357
],
358+
"addressSuggestionDropdown.suggested": [
359+
{
360+
"type": 0,
361+
"value": "SUGGESTED"
362+
}
363+
],
358364
"auth_modal.button.close.assistive_msg": [
359365
{
360366
"type": 0,

packages/template-retail-react-app/app/static/translations/compiled/en-US.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@
355355
"value": "You Might Also Like"
356356
}
357357
],
358+
"addressSuggestionDropdown.suggested": [
359+
{
360+
"type": 0,
361+
"value": "SUGGESTED"
362+
}
363+
],
358364
"auth_modal.button.close.assistive_msg": [
359365
{
360366
"type": 0,

packages/template-retail-react-app/app/static/translations/compiled/en-XA.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,20 @@
739739
"value": "]"
740740
}
741741
],
742+
"addressSuggestionDropdown.suggested": [
743+
{
744+
"type": 0,
745+
"value": "["
746+
},
747+
{
748+
"type": 0,
749+
"value": "ŞŬƓƓḖŞŦḖḒ"
750+
},
751+
{
752+
"type": 0,
753+
"value": "]"
754+
}
755+
],
742756
"auth_modal.button.close.assistive_msg": [
743757
{
744758
"type": 0,

packages/template-retail-react-app/translations/en-GB.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@
144144
"add_to_cart_modal.recommended_products.title.might_also_like": {
145145
"defaultMessage": "You Might Also Like"
146146
},
147+
"addressSuggestionDropdown.suggested": {
148+
"defaultMessage": "SUGGESTED"
149+
},
147150
"auth_modal.button.close.assistive_msg": {
148151
"defaultMessage": "Close login form"
149152
},

packages/template-retail-react-app/translations/en-US.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@
144144
"add_to_cart_modal.recommended_products.title.might_also_like": {
145145
"defaultMessage": "You Might Also Like"
146146
},
147+
"addressSuggestionDropdown.suggested": {
148+
"defaultMessage": "SUGGESTED"
149+
},
147150
"auth_modal.button.close.assistive_msg": {
148151
"defaultMessage": "Close login form"
149152
},

0 commit comments

Comments
 (0)