sfc-utils 1.4.72 → 1.4.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -67,7 +67,7 @@ const Geocoder = ({
67
67
  // POST as form url encoded data
68
68
  let formData = new FormData();
69
69
  formData.append("query", query);
70
- if(filterRegion != "United States"){
70
+ if (filterRegion != "United States") {
71
71
  formData.append("region", filterRegion);
72
72
  }
73
73
  // Remove any existing event listeners
@@ -109,6 +109,12 @@ const Geocoder = ({
109
109
  // Handle result
110
110
  if (output.data.length === 0) {
111
111
  // We could show something saying "No results" ... or we could not
112
+ if (output.fallback) {
113
+ // If we're using the fallback, we need to encourage the user to enter city
114
+ setLocData([
115
+ { name: "No results, make sure to include city name" },
116
+ ]);
117
+ }
112
118
  } else {
113
119
  // Create a keydown event listener
114
120
  setSingletonEventListener("keydown", function resultsKeyHandler(e) {
@@ -181,10 +187,13 @@ const Geocoder = ({
181
187
 
182
188
  // If the parent component passes in a string for inputValueOverride, use it
183
189
  useEffect(() => {
184
- if (typeof inputValueOverride === 'string' || inputValueOverride instanceof String) {
185
- setInputValue(inputValueOverride)
190
+ if (
191
+ typeof inputValueOverride === "string" ||
192
+ inputValueOverride instanceof String
193
+ ) {
194
+ setInputValue(inputValueOverride);
186
195
  }
187
- }, [inputValueOverride])
196
+ }, [inputValueOverride]);
188
197
 
189
198
  return (
190
199
  <div className={geocoderStyles.wrapper}>
@@ -212,6 +221,11 @@ const Geocoder = ({
212
221
  className={thisClass}
213
222
  key={i}
214
223
  onClick={() => {
224
+ if (
225
+ locData[i].name.toLowerCase().indexOf("no results") > -1
226
+ ) {
227
+ return false;
228
+ }
215
229
  setInputValue(locData[i].name);
216
230
  // Call function if it exists
217
231
  if (resultFunc) {
@@ -227,11 +241,13 @@ const Geocoder = ({
227
241
  }}
228
242
  >
229
243
  <div className={geocoderStyles.name}>{loc.name}</div>
230
- <div className={geocoderStyles.details}>
231
- {loc.locality}
232
- {loc.locality && loc.region && ", "}
233
- {loc.region}
234
- </div>
244
+ {(loc.locality || loc.region) && (
245
+ <div className={geocoderStyles.details}>
246
+ {loc.locality}
247
+ {loc.locality && loc.region && ", "}
248
+ {loc.region}
249
+ </div>
250
+ )}
235
251
  </button>
236
252
  </li>
237
253
  );
package/nav2.js CHANGED
@@ -1,13 +1,7 @@
1
1
  let { getBrands } = require("./brands");
2
2
 
3
3
  // Handle nav for various markets and include nav options for other links
4
- let getNav2 = function (
5
- meta,
6
- urlAdd,
7
- forceColor,
8
- navLink,
9
- navArray
10
- ) {
4
+ let getNav2 = function (meta, urlAdd, forceColor, navLink, navArray) {
11
5
  // If we aren't passing meta in, we have to call getSettings here
12
6
  if (!meta) {
13
7
  let { getSettings } = require("./settings");
@@ -141,7 +135,7 @@ let getNav2 = function (
141
135
  >
142
136
  ${navLink.text}${dropdownIcon}
143
137
  </a>
144
- `
138
+ `;
145
139
  }
146
140
 
147
141
  let rightBlock = `
@@ -149,7 +143,6 @@ let getNav2 = function (
149
143
  <div>Subscribe</div>
150
144
  </a>
151
145
  `;
152
-
153
146
 
154
147
  let navHTML = `<nav class="nav2-container ${invertClass}">
155
148
  <div class="nav2-left">
@@ -166,12 +159,12 @@ let getNav2 = function (
166
159
  class="nav2-desk-logo"
167
160
  alt="Logo"
168
161
  src="https://files.sfchronicle.com/static-assets/logos/${marketPrefix}-${color}.png"
169
- ></img>
162
+ />
170
163
  <img
171
164
  class="nav2-mobile-logo"
172
165
  alt="Logo"
173
166
  src="https://files.sfchronicle.com/static-assets/logos/${marketPrefix}-square-${color}.png"
174
- ></img>
167
+ />
175
168
  </div>
176
169
  </a>
177
170
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.4.72",
3
+ "version": "1.4.74",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",
@@ -14,4 +14,4 @@
14
14
  "react-transition-group": "^4.4.5",
15
15
  "write": "^2.0.0"
16
16
  }
17
- }
17
+ }