/
locator.tsx
61 lines (55 loc) · 1.46 KB
/
locator.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// locator.tsx
import * as React from "react";
import "../index.css";
import {
GetHeadConfig,
GetPath,
Template,
TemplateProps,
TemplateRenderProps,
} from "@yext/pages";
import PageLayout from "../components/PageLayout";
import {
provideHeadless,
SandboxEndpoints,
SearchHeadlessProvider,
} from "@yext/search-headless-react";
import { FilterSearch } from "@yext/search-ui-react";
export const getPath: GetPath<TemplateProps> = () => {
return `locator`;
};
export const getHeadConfig: GetHeadConfig<TemplateRenderProps> = () => {
return {
title: "Turtlehead Tacos Locations",
charset: "UTF-8",
viewport: "width=device-width, initial-scale=1",
};
};
const searcher = provideHeadless({
apiKey: YEXT_PUBLIC_SEARCH_API_KEY,
// make sure your experience key matches what you see in the platform
experienceKey: "turtlehead-tacos-locator",
locale: "en",
endpoints: SandboxEndpoints,
verticalKey: "locations",
});
const Locator: Template<TemplateRenderProps> = () => {
return (
<PageLayout>
<SearchHeadlessProvider searcher={searcher}>
<div className="mx-auto max-w-7xl px-4">
<FilterSearch
placeholder="Find Locations Near You"
searchFields={[
{
entityType: "location",
fieldApiName: "builtin.location",
},
]}
/>
</div>
</SearchHeadlessProvider>
</PageLayout>
);
};
export default Locator;