Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 05534f1

Browse files
author
vvo
committed
fix(autocomplete): show the corresponding hint
Was not working because of template strings having linebreaks. fixes #29
1 parent 6127c36 commit 05534f1

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/formatAutocompleteSuggestion.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ export default function formatAutocompleteSuggestion({
88
isCity,
99
name
1010
}) {
11-
return (
12-
`<span class="pl-icon">${icons[isCity === false ? 'address' : 'city']}</span>
11+
const out = `<span class="pl-icon">${icons[isCity === false ? 'address' : 'city']}</span>
1312
<span class="pl-name">${name}</span> <span class="pl-address">
1413
${isCity === false ? `${city},` : ``}
1514
${administrative},
16-
${country}</span>`);
15+
${country}</span>`
16+
.replace(/\n/g, '');
17+
18+
return out;
1719
}

src/formatInputValue.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ export default function formatInputValue({
55
isCity,
66
name
77
}) {
8-
return (
9-
`${name}
8+
const out = `${name}
109
${isCity === false ? ` ${city},` : ''}
1110
${administrative},
12-
${country}`);
11+
${country}`
12+
.replace(/\n/g, '');
13+
14+
return out;
1315
}

src/places.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ $greyish: #a4a4a4;
77
.algolia-places {
88
width: 100%; // we ask the autocomplete to take the full width of his container
99

10+
.aa-hint {color: #dedede}
11+
1012
.aa-input {
1113
border: solid 0.063em rgba(255, 255, 255, 0.5);
1214
box-shadow: 0 0.063em 0.625em rgba(0, 0, 0, 0.2), 0 0.125em 0.250em 0 rgba(0, 0, 0, 0.1);

0 commit comments

Comments
 (0)