@graphcommerce/docs 3.1.4 → 4.0.0
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.
- package/CHANGELOG.md +9 -0
- package/{content/framework → framework}/deployment.md +0 -0
- package/{content/framework → framework}/environment-variables.md +0 -0
- package/{content/framework → framework}/favicon.md +0 -0
- package/{content/framework → framework}/graphcms.md +0 -0
- package/{content/framework → framework}/icons.md +0 -0
- package/{content/framework → framework}/readme.md +0 -0
- package/{content/framework → framework}/seo.md +0 -0
- package/{content/framework → framework}/static-file-serving.md +0 -0
- package/{content/framework → framework}/static-generation.md +0 -0
- package/{content/framework → framework}/theming.md +0 -0
- package/{content/framework → framework}/translations.md +0 -0
- package/{content/framework → framework}/troubleshooting.md +0 -0
- package/{content/framework → framework}/typography.md +0 -0
- package/{content/getting-started → getting-started}/create.md +0 -0
- package/{content/getting-started → getting-started}/graphcms-component.md +0 -0
- package/{content/getting-started → getting-started}/header.md +0 -0
- package/{content/getting-started → getting-started}/pages.md +0 -0
- package/{content/getting-started → getting-started}/readme.md +0 -0
- package/{content/getting-started → getting-started}/start-building.md +0 -0
- package/{content/getting-started → getting-started}/vscode.md +0 -0
- package/package.json +6 -51
- package/{content/readme.md → readme.md} +0 -0
- package/{content/roadmap.md → roadmap.md} +0 -0
- package/.babelrc +0 -4
- package/components/Layout/LayoutFull.tsx +0 -85
- package/components/Layout/Logo.tsx +0 -19
- package/components/Layout/graphcommerce.svg +0 -34
- package/components/Search.tsx +0 -37
- package/components/SearchForm.tsx +0 -110
- package/components/SidebarMenu/index.tsx +0 -101
- package/components/prism.css +0 -274
- package/components/rehype-prism-plus.css +0 -49
- package/components/theme.ts +0 -410
- package/lib/DocumentIndexer.ts +0 -59
- package/lib/files.ts +0 -168
- package/lib/instantSearch.ts +0 -26
- package/lib/typesense/IndexerHandler.ts +0 -47
- package/lib/typesense/Leaves.ts +0 -37
- package/lib/typesense/SearchIndexer.ts +0 -64
- package/lib/typesense/batchInterable.ts +0 -13
- package/lib/typesense/createInstantSearchProps.ts +0 -36
- package/lib/typesense/typesenseClientConf.ts +0 -23
- package/lib/typesense/typesenseIndexerHandler.ts +0 -23
- package/next-env.d.ts +0 -5
- package/next.config.js +0 -21
- package/pages/[[...url]].tsx +0 -391
- package/pages/_app.tsx +0 -26
- package/pages/_document.tsx +0 -22
- package/pages/api/reindex.ts +0 -4
- package/pages/menu/[[...url]].tsx +0 -69
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.svg +0 -12
- package/public/link.svg +0 -4
- package/public/manifest/favicon-192.png +0 -0
- package/public/manifest/favicon-512.png +0 -0
- package/public/manifest.webmanifest +0 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#1302](https://github.com/ho-nl/m2-pwa/pull/1302)
|
|
8
|
+
[`22ea2a0af`](https://github.com/ho-nl/m2-pwa/commit/22ea2a0af373dbd427e85f6ac82a074b1928a289)
|
|
9
|
+
Thanks [@paales](https://github.com/paales)! - Moved all rendering of docs to
|
|
10
|
+
https://www.graphcommerce.org/docs and use this only as a content package.
|
|
11
|
+
|
|
3
12
|
## 3.1.4
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,56 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphcommerce/docs",
|
|
3
|
-
"homepage": "https://www.graphcommerce.org/",
|
|
4
|
-
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "
|
|
6
|
-
"
|
|
7
|
-
"sideEffects": false,
|
|
8
|
-
"main": "index.js",
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"@graphcommerce/framer-next-pages": "^3.1.0",
|
|
11
|
-
"@graphcommerce/image": "^3.1.0",
|
|
12
|
-
"@graphcommerce/next-config": "^3.0.3",
|
|
13
|
-
"@graphcommerce/next-ui": "^4.2.2",
|
|
14
|
-
"@graphcommerce/react-hook-form": "^3.0.3",
|
|
15
|
-
"@mui/material": "^5.4.3",
|
|
16
|
-
"instantsearch.js": "^4.39.0",
|
|
17
|
-
"next": "^12.1.0",
|
|
18
|
-
"next-mdx-remote": "^4.0.0",
|
|
19
|
-
"react": "^17.0.2",
|
|
20
|
-
"react-dom": "^17.0.2",
|
|
21
|
-
"react-instantsearch-hooks": "^6.22.0",
|
|
22
|
-
"rehype-autolink-headings": "^6.1.1",
|
|
23
|
-
"rehype-prism-plus": "^1.3.2",
|
|
24
|
-
"rehype-slug": "^5.0.1",
|
|
25
|
-
"remark": "^14.0.2",
|
|
26
|
-
"remark-gfm": "^3.0.1",
|
|
27
|
-
"strip-markdown": "^5.0.0",
|
|
28
|
-
"to-vfile": "^7.2.3",
|
|
29
|
-
"type-fest": "^2.12.0",
|
|
30
|
-
"typesense": "^1.2.1",
|
|
31
|
-
"typesense-instantsearch-adapter": "^2.4.0",
|
|
32
|
-
"vfile-matter": "^3.0.1"
|
|
33
|
-
},
|
|
3
|
+
"homepage": "https://www.graphcommerce.org/docs",
|
|
4
|
+
"repository": "github:graphcommerce-org/graphcommerce/docs",
|
|
5
|
+
"version": "4.0.0",
|
|
6
|
+
"sideEffects": true,
|
|
34
7
|
"devDependencies": {
|
|
35
|
-
"@graphcommerce/
|
|
36
|
-
"@graphcommerce/prettier-config-pwa": "^4.0.2",
|
|
37
|
-
"@graphcommerce/typescript-config-pwa": "^4.0.2",
|
|
38
|
-
"eslint": "^8.10.0",
|
|
39
|
-
"typescript": "^4.5.5"
|
|
40
|
-
},
|
|
41
|
-
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
42
|
-
"eslintConfig": {
|
|
43
|
-
"extends": "@graphcommerce/eslint-config-pwa",
|
|
44
|
-
"parserOptions": {
|
|
45
|
-
"project": "./tsconfig.json"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"engines": {
|
|
49
|
-
"node": "14.x"
|
|
8
|
+
"@graphcommerce/prettier-config-pwa": "^4.0.2"
|
|
50
9
|
},
|
|
51
|
-
"
|
|
52
|
-
"dev": "next dev -p 3002",
|
|
53
|
-
"build": "next build",
|
|
54
|
-
"start": "next start"
|
|
55
|
-
}
|
|
10
|
+
"prettier": "@graphcommerce/prettier-config-pwa"
|
|
56
11
|
}
|
|
File without changes
|
|
File without changes
|
package/.babelrc
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
iconMenu,
|
|
3
|
-
LayoutDefault,
|
|
4
|
-
LayoutDefaultProps,
|
|
5
|
-
responsiveVal,
|
|
6
|
-
IconSvg,
|
|
7
|
-
} from '@graphcommerce/next-ui'
|
|
8
|
-
import { Box, Fab } from '@mui/material'
|
|
9
|
-
import Link from 'next/link'
|
|
10
|
-
import { useRouter } from 'next/router'
|
|
11
|
-
import { FileNode } from '../../lib/files'
|
|
12
|
-
import { Search } from '../Search'
|
|
13
|
-
import SidebarMenu from '../SidebarMenu'
|
|
14
|
-
import { Logo } from './Logo'
|
|
15
|
-
|
|
16
|
-
export type LayoutFullProps = Omit<
|
|
17
|
-
LayoutDefaultProps,
|
|
18
|
-
'pages' | 'classes' | 'header' | 'cartFab' | 'menuFab' | 'footer'
|
|
19
|
-
> & { menuData?: FileNode }
|
|
20
|
-
|
|
21
|
-
export function LayoutFull(props: LayoutFullProps) {
|
|
22
|
-
const { children, menuData } = props
|
|
23
|
-
|
|
24
|
-
const router = useRouter()
|
|
25
|
-
|
|
26
|
-
const selected = router.asPath.split('?')[0].split('#')[0]
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<LayoutDefault
|
|
30
|
-
header={<Logo />}
|
|
31
|
-
footer=''
|
|
32
|
-
menuFab={
|
|
33
|
-
<Link href={`/menu${selected}`} passHref>
|
|
34
|
-
<Fab
|
|
35
|
-
size='responsive'
|
|
36
|
-
sx={{
|
|
37
|
-
display: { sm: undefined, md: 'none' },
|
|
38
|
-
backgroundColor: 'text.primary',
|
|
39
|
-
color: 'background.paper',
|
|
40
|
-
'&:hover, &:focus': {
|
|
41
|
-
boxShadow: 'none',
|
|
42
|
-
backgroundColor: 'text.primary',
|
|
43
|
-
},
|
|
44
|
-
}}
|
|
45
|
-
>
|
|
46
|
-
<IconSvg src={iconMenu} size='medium' />
|
|
47
|
-
</Fab>
|
|
48
|
-
</Link>
|
|
49
|
-
}
|
|
50
|
-
sx={[
|
|
51
|
-
(theme) => ({
|
|
52
|
-
'& header': {
|
|
53
|
-
p: 0,
|
|
54
|
-
},
|
|
55
|
-
'& header a, & header > div': {
|
|
56
|
-
backgroundColor: theme.palette.background.paper,
|
|
57
|
-
[theme.breakpoints.up('md')]: {
|
|
58
|
-
borderRight: `1px solid ${theme.palette.divider}`,
|
|
59
|
-
width: `${responsiveVal(320, 340)}`,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
'& .LayoutDefault-children': {
|
|
63
|
-
display: 'grid',
|
|
64
|
-
gridAutoFlow: 'column',
|
|
65
|
-
gridTemplateColumns: { xs: '1fe', md: `${responsiveVal(320, 340)} 1fr` },
|
|
66
|
-
borderTop: `1px solid ${theme.palette.divider}`,
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
]}
|
|
70
|
-
>
|
|
71
|
-
<Box
|
|
72
|
-
sx={{
|
|
73
|
-
backgroundColor: (theme) => theme.palette.background.paper,
|
|
74
|
-
padding: 2,
|
|
75
|
-
borderRight: (theme) => `1px solid ${theme.palette.divider}`,
|
|
76
|
-
display: { xs: 'none', md: 'block' },
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
<Search />
|
|
80
|
-
{menuData && <SidebarMenu {...menuData} selected={selected} />}
|
|
81
|
-
</Box>
|
|
82
|
-
<Box sx={{ mb: 15 }}>{children}</Box>
|
|
83
|
-
</LayoutDefault>
|
|
84
|
-
)
|
|
85
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Logo as LogoBase } from '@graphcommerce/next-ui'
|
|
2
|
-
import svgLogo from './graphcommerce.svg'
|
|
3
|
-
|
|
4
|
-
export function Logo() {
|
|
5
|
-
return (
|
|
6
|
-
<LogoBase
|
|
7
|
-
sx={{
|
|
8
|
-
'& .GcLogo-logo': {
|
|
9
|
-
width: 'auto',
|
|
10
|
-
height: { xs: '24px', md: '36px' },
|
|
11
|
-
paddingLeft: { xs: '10px', md: '52px' },
|
|
12
|
-
marginTop: { xs: 0, md: '4px' },
|
|
13
|
-
filter: (theme) => (theme.palette.mode === 'dark' ? 'invert(100%)' : 'invert(0%)'),
|
|
14
|
-
},
|
|
15
|
-
}}
|
|
16
|
-
image={{ alt: 'GraphCommerce Logo', src: svgLogo, unoptimized: true }}
|
|
17
|
-
/>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg width="690px" height="120px" viewBox="0 0 690 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<title>graphcommerce</title>
|
|
4
|
-
<defs>
|
|
5
|
-
<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-1">
|
|
6
|
-
<stop stop-color="#01E6C2" offset="0%"></stop>
|
|
7
|
-
<stop stop-color="#01717F" offset="100%"></stop>
|
|
8
|
-
</linearGradient>
|
|
9
|
-
</defs>
|
|
10
|
-
<g id="graphcommerce" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
11
|
-
<g id="Group" transform="translate(-14.000000, 0.000000)">
|
|
12
|
-
<g id="Path" transform="translate(17.000000, 10.000000)">
|
|
13
|
-
<polygon fill="#01717F" fill-rule="nonzero" points="42.81 50 9.46 69.47 9.46 69.47 9.46 69.47 9.46 69.48 9.46 69.48 42.81 88.95 76.16 69.47"></polygon>
|
|
14
|
-
<polygon fill="#01BAB1" fill-rule="nonzero" points="42.81 31.55 9.46 51.02 9.46 51.02 9.46 51.02 9.46 51.03 9.46 51.03 42.81 70.5 76.16 51.02"></polygon>
|
|
15
|
-
<polygon fill="#01E6C2" fill-rule="nonzero" points="42.81 11.05 9.46 30.52 9.46 30.52 9.46 30.52 9.46 30.53 9.46 30.53 42.81 50 76.16 30.52"></polygon>
|
|
16
|
-
<polygon stroke="url(#linearGradient-1)" stroke-width="5" points="0 25 0 75 42.81 100 85.62 75 85.62 25 42.81 0"></polygon>
|
|
17
|
-
</g>
|
|
18
|
-
</g>
|
|
19
|
-
<path d="M150.55011,85.8585815 C155.156677,85.8585815 159.091339,84.9827881 162.354095,83.2312012 C165.616852,81.4796143 168.119537,78.9639282 169.862152,75.6841431 C171.604767,72.4043579 172.476074,68.4719849 172.476074,63.8870239 L172.476074,58.6459961 L151.304871,58.6459961 L151.304871,65.182312 L164.478027,65.182312 L164.463745,66.015625 C164.429321,68.5391846 163.825897,70.7545776 162.653473,72.6618042 C161.481049,74.5690308 159.860931,76.0529175 157.793121,77.1134644 C155.725311,78.1740112 153.33551,78.7042847 150.623718,78.7042847 C147.442078,78.7042847 144.690094,77.929657 142.367767,76.3804016 C140.045441,74.8311462 138.253387,72.6097107 136.991608,69.716095 C135.729828,66.8224792 135.098938,63.3765259 135.098938,59.3782349 L135.098938,59.3430786 C135.098938,55.4154663 135.715363,52.0492554 136.948212,49.2444458 C138.181061,46.4396362 139.946472,44.2919006 142.244446,42.801239 C144.542419,41.3105774 147.284241,40.5652466 150.46991,40.5652466 C153.739441,40.5652466 156.49527,41.3657837 158.737396,42.9668579 C160.979523,44.5679321 162.618225,46.8153687 163.653503,49.7091675 L163.786987,50.0881958 L172.100891,50.0881958 L171.954773,49.486145 C171.273987,46.4081421 169.991425,43.6609192 168.107086,41.2444763 C166.222748,38.8280334 163.800629,36.918335 160.840729,35.5153809 C157.880829,34.1124268 154.418945,33.4109497 150.455078,33.4109497 C145.641602,33.4109497 141.465332,34.4641724 137.92627,36.5706177 C134.387207,38.677063 131.650421,41.6675415 129.715912,45.5420532 C127.781403,49.4165649 126.814148,54.0291748 126.814148,59.3798828 L126.814148,59.4150391 C126.814148,64.8543701 127.782593,69.5496521 129.719482,73.500885 C131.656372,77.4521179 134.400482,80.4995422 137.951813,82.643158 C141.503143,84.7867737 145.702576,85.8585815 150.55011,85.8585815 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
|
|
20
|
-
<path d="M178.793398,85 L186.638735,85 L186.638735,63.0449219 C186.638735,61.2032471 186.957338,59.6324768 187.594545,58.3326111 C188.231752,57.0327454 189.145815,56.0410461 190.336733,55.3575134 C191.527651,54.6739807 192.932802,54.3322144 194.552187,54.3322144 C195.302187,54.3322144 195.988191,54.3746948 196.610201,54.4596558 C197.23221,54.5446167 197.699404,54.651001 198.011781,54.7788086 L198.011781,47.5481567 C197.714052,47.4719849 197.332552,47.4009399 196.867281,47.335022 C196.40201,47.269104 195.892519,47.236145 195.338808,47.236145 C193.222475,47.236145 191.41797,47.8670349 189.925295,49.1288147 C188.432619,50.3905945 187.393862,52.1201172 186.809023,54.3173828 L186.638735,54.3173828 L186.638735,47.9689331 L178.793398,47.9689331 L178.793398,85 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
|
|
21
|
-
<path d="M212.383085,85.6591797 C214.028471,85.6591797 215.5726,85.3947754 217.015471,84.8659668 C218.458342,84.3371582 219.752348,83.5881653 220.89749,82.618988 C222.042631,81.6498108 222.969145,80.5093384 223.677031,79.1975708 L223.84677,79.1975708 L223.84677,85 L231.692656,85 L231.692656,59.4880981 C231.692656,57.0117798 231.081816,54.8563538 229.860136,53.0218201 C228.638457,51.1872864 226.916533,49.7643738 224.694365,48.7530823 C222.472197,47.7417908 219.844084,47.236145 216.810026,47.236145 C213.760222,47.236145 211.127623,47.7334595 208.91223,48.7280884 C206.696837,49.7227173 204.963194,51.0733032 203.711302,52.7798462 C202.45941,54.4863892 201.73715,56.4133911 201.544523,58.5608521 L201.509367,58.9624023 L208.865813,58.9624023 L208.936125,58.638855 C209.248503,57.1740112 210.060759,55.9794312 211.372893,55.0551147 C212.685026,54.1307983 214.422697,53.6686401 216.585905,53.6686401 C218.915739,53.6686401 220.708342,54.2425842 221.963713,55.3904724 C223.219084,56.5383606 223.84677,58.1107788 223.84677,60.1077271 L223.84677,71.1643677 C223.84677,72.7317505 223.438353,74.1429443 222.621519,75.3979492 C221.804686,76.6529541 220.698271,77.6408081 219.302275,78.3615112 C217.906279,79.0822144 216.32791,79.4425659 214.567168,79.4425659 C212.544585,79.4425659 210.926115,78.9782104 209.71176,78.0494995 C208.497404,77.1207886 207.890227,75.8555298 207.890227,74.2537231 L207.890227,74.1911011 C207.890227,72.6361694 208.498137,71.3894958 209.713957,70.4510803 C210.929777,69.5126648 212.661223,68.9780884 214.908293,68.8473511 L227.87216,68.0371094 L227.87216,62.6098633 L213.853606,63.4420776 C209.458342,63.7006226 206.051665,64.7811279 203.633574,66.6835938 C201.215483,68.5860596 200.006438,71.1618042 200.006438,74.4108276 L200.006438,74.4734497 C200.006438,76.6817017 200.525999,78.6288452 201.565123,80.3148804 C202.604246,82.0009155 204.053709,83.3131409 205.913512,84.2515564 C207.773314,85.1899719 209.929838,85.6591797 212.383085,85.6591797 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
|
|
22
|
-
<path d="M238.576801,97.3046875 L246.422138,97.3046875 L246.422138,78.7581177 L246.592426,78.7581177 C247.331439,80.1987915 248.274982,81.4398804 249.423053,82.4813843 C250.571125,83.5228882 251.898822,84.3250732 253.406147,84.8879395 C254.913471,85.4508057 256.53963,85.7322388 258.284626,85.7322388 C261.388996,85.7322388 264.088153,84.9505615 266.382099,83.387207 C268.676044,81.8238525 270.458759,79.605896 271.730243,76.7333374 C273.001728,73.8607788 273.63747,70.4537354 273.63747,66.512207 L273.63747,66.4770508 C273.63747,62.5307617 273.003925,59.1166687 271.736835,56.2347717 C270.469745,53.3528748 268.677509,51.1326294 266.360126,49.5740356 C264.042743,48.0154419 261.31081,47.236145 258.164325,47.236145 C256.410541,47.236145 254.792896,47.5235291 253.311389,48.0982971 C251.829883,48.6730652 250.525714,49.4860535 249.398883,50.537262 C248.272052,51.5884705 247.338947,52.8508911 246.599567,54.3245239 L246.422138,54.3245239 L246.422138,47.9689331 L238.576801,47.9689331 L238.576801,97.3046875 Z M256.053852,79.02948 C254.157245,79.02948 252.486316,78.5133972 251.041065,77.4812317 C249.595813,76.4490662 248.45763,74.9961243 247.626514,73.122406 C246.795398,71.2486877 246.37984,69.0476685 246.37984,66.5193481 L246.37984,66.4841919 C246.37984,63.9324341 246.790729,61.7197876 247.612506,59.8462524 C248.434284,57.9727173 249.573749,56.5198669 251.030902,55.4877014 C252.488056,54.4555359 254.162372,53.9394531 256.053852,53.9394531 C258.019672,53.9394531 259.72063,54.4416199 261.156726,55.4459534 C262.592823,56.4502869 263.698505,57.8892212 264.473773,59.7627563 C265.249042,61.6362915 265.636676,63.8743896 265.636676,66.4770508 L265.636676,66.512207 C265.636676,69.0727539 265.250232,71.2897949 264.477344,73.1633301 C263.704456,75.0368652 262.599964,76.4829407 261.163867,77.5015564 C259.727771,78.5201721 258.024433,79.02948 256.053852,79.02948 Z" id="Shape" fill="#000000" fill-rule="nonzero"></path>
|
|
23
|
-
<path d="M279.338574,85 L287.183911,85 L287.183911,63.5651245 C287.183911,61.659729 287.541058,59.987793 288.255352,58.5493164 C288.969647,57.1108398 289.973614,55.9829102 291.267254,55.1655273 C292.560894,54.3481445 294.067029,53.9394531 295.785656,53.9394531 C298.425305,53.9394531 300.471234,54.7895203 301.923443,56.4896545 C303.375653,58.1897888 304.101758,60.5506592 304.101758,63.5722656 L304.101758,85 L311.947094,85 L311.947094,62.078125 C311.947094,59.0909424 311.403637,56.4877319 310.316723,54.2684937 C309.229809,52.0492554 307.705365,50.3223877 305.74339,49.0878906 C303.781415,47.8533936 301.472912,47.236145 298.817883,47.236145 C296.055188,47.236145 293.698712,47.8336182 291.748456,49.0285645 C289.798199,50.2235107 288.333264,51.9108276 287.35365,54.0905151 L287.183911,54.0905151 L287.183911,34.2695312 L279.338574,34.2695312 L279.338574,85 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
|
|
24
|
-
<path d="M341.507021,85.8585815 C345.280458,85.8585815 348.676973,85.1461182 351.696565,83.7211914 C354.716158,82.2962646 357.195406,80.3033447 359.13431,77.7424316 C361.073213,75.1815186 362.293154,72.208252 362.79413,68.8226318 L362.85016,68.4633789 L354.810915,68.4633789 L354.720278,68.7946167 C354.110903,70.9285278 353.191896,72.7317505 351.963259,74.2042847 C350.734621,75.6768188 349.243593,76.7949524 347.490175,77.5586853 C345.736757,78.3224182 343.744936,78.7042847 341.514711,78.7042847 C338.436342,78.7042847 335.748262,77.9215088 333.450472,76.355957 C331.152681,74.7904053 329.376833,72.5760193 328.122926,69.7127991 C326.86902,66.8495789 326.242067,63.4819946 326.242067,59.6100464 L326.242067,59.5748901 C326.242067,55.6890259 326.86902,52.3273926 328.122926,49.4899902 C329.376833,46.6525879 331.146822,44.45578 333.432894,42.8995667 C335.718965,41.3433533 338.410341,40.5652466 341.507021,40.5652466 C343.785585,40.5652466 345.804964,40.9507751 347.565157,41.7218323 C349.32535,42.4928894 350.799715,43.586853 351.988252,45.0037231 C353.17679,46.4205933 354.045351,48.1212769 354.593935,50.1057739 L354.796083,50.8061523 L362.835329,50.8061523 L362.779848,50.461731 C362.278505,47.0896606 361.057375,44.1265564 359.116457,41.5724182 C357.175539,39.01828 354.696565,37.0195007 351.679537,35.5760803 C348.662508,34.1326599 345.271669,33.4109497 341.507021,33.4109497 C336.703432,33.4109497 332.536775,34.4735107 329.007051,36.5986328 C325.477327,38.7237549 322.748598,41.7420654 320.820863,45.6535645 C318.893129,49.5650635 317.929262,54.2078857 317.929262,59.5820312 L317.929262,59.6171875 C317.929262,64.991333 318.891847,69.6400146 320.817018,73.5632324 C322.742189,77.4864502 325.474306,80.5164795 329.013368,82.6533203 C332.552431,84.7901611 336.716982,85.8585815 341.507021,85.8585815 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
|
|
25
|
-
<path d="M384.646104,85.7322388 C388.202013,85.7322388 391.299242,84.9564209 393.937791,83.4047852 C396.576341,81.8531494 398.627763,79.6410522 400.092058,76.7684937 C401.556352,73.8959351 402.288499,70.4703979 402.288499,66.4918823 L402.288499,66.4215698 C402.288499,62.4525757 401.55269,59.0364685 400.081071,56.1732483 C398.609453,53.3100281 396.549699,51.1047058 393.901811,49.5572815 C391.253923,48.0098572 388.159532,47.236145 384.618639,47.236145 C381.100816,47.236145 378.017961,48.0110474 375.370073,49.5608521 C372.722185,51.1106567 370.662431,53.3184509 369.190813,56.1842346 C367.719194,59.0500183 366.983385,62.4624634 366.983385,66.4215698 L366.983385,66.4918823 C366.983385,70.4469604 367.714342,73.8653564 369.176256,76.7470703 C370.63817,79.6287842 372.693071,81.8467407 375.340959,83.4009399 C377.988847,84.9551392 381.090562,85.7322388 384.646104,85.7322388 Z M384.681261,79.2200928 C382.720567,79.2200928 381.014299,78.7210388 379.562456,77.7229309 C378.110612,76.724823 376.984605,75.2755432 376.184434,73.3750916 C375.384264,71.4746399 374.984178,69.1802368 374.984178,66.4918823 L374.984178,66.4215698 C374.984178,63.7379761 375.385545,61.4552002 376.18828,59.5732422 C376.991014,57.6912842 378.118211,56.250061 379.569871,55.2495728 C381.021532,54.2490845 382.704454,53.7488403 384.618639,53.7488403 C386.56981,53.7488403 388.271226,54.2445068 389.722887,55.2358398 C391.174547,56.2271729 392.298265,57.668396 393.094041,59.5595093 C393.889818,61.4506226 394.287706,63.7379761 394.287706,66.4215698 L394.287706,66.4918823 C394.287706,69.1802368 393.892198,71.4746399 393.101182,73.3750916 C392.310167,75.2755432 391.198167,76.724823 389.765184,77.7229309 C388.332201,78.7210388 386.637559,79.2200928 384.681261,79.2200928 Z" id="Shape" fill="#000000" fill-rule="nonzero"></path>
|
|
26
|
-
<path d="M407.687668,85 L415.533005,85 L415.533005,62.1511841 C415.533005,60.562561 415.859665,59.1539307 416.512986,57.925293 C417.166306,56.6966553 418.062607,55.7251892 419.20189,55.0108948 C420.341172,54.2966003 421.651108,53.9394531 423.131699,53.9394531 C425.253525,53.9394531 426.934342,54.5646667 428.174149,55.815094 C429.413956,57.0655212 430.03386,58.7650146 430.03386,60.9135742 L430.03386,85 L437.725388,85 L437.725388,61.9006958 C437.725388,60.3442993 438.041611,58.96698 438.674057,57.7687378 C439.306504,56.5704956 440.187607,55.6327209 441.317368,54.9554138 C442.447129,54.2781067 443.752305,53.9394531 445.232895,53.9394531 C447.471177,53.9394531 449.196305,54.5959778 450.40828,55.9090271 C451.620255,57.2220764 452.226243,59.0640259 452.226243,61.4348755 L452.226243,85 L460.071579,85 L460.071579,59.5380859 C460.071579,57.0566406 459.569687,54.8974609 458.565903,53.0605469 C457.562119,51.2236328 456.156144,49.7936707 454.347977,48.7706604 C452.539811,47.7476501 450.416428,47.236145 447.977829,47.236145 C446.213425,47.236145 444.571152,47.5333252 443.051011,48.1276855 C441.530869,48.7220459 440.203721,49.5650635 439.069565,50.6567383 C437.93541,51.7484131 437.052842,53.0570679 436.42186,54.5827026 L436.252121,54.5827026 C435.780442,53.0142212 435.056077,51.6853333 434.079026,50.5960388 C433.101975,49.5067444 431.927353,48.6744385 430.555161,48.0991211 C429.182969,47.5238037 427.642869,47.236145 425.934861,47.236145 C423.517869,47.236145 421.407303,47.8306885 419.603165,49.0197754 C417.799027,50.2088623 416.49907,51.7789917 415.703293,53.7301636 L415.533005,53.7301636 L415.533005,47.9689331 L407.687668,47.9689331 L407.687668,85 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
|
|
27
|
-
<path d="M466.92675,85 L474.772087,85 L474.772087,62.1511841 C474.772087,60.562561 475.098747,59.1539307 475.752068,57.925293 C476.405388,56.6966553 477.301689,55.7251892 478.440971,55.0108948 C479.580254,54.2966003 480.89019,53.9394531 482.370781,53.9394531 C484.492607,53.9394531 486.173424,54.5646667 487.413231,55.815094 C488.653038,57.0655212 489.272942,58.7650146 489.272942,60.9135742 L489.272942,85 L496.96447,85 L496.96447,61.9006958 C496.96447,60.3442993 497.280693,58.96698 497.913139,57.7687378 C498.545586,56.5704956 499.426689,55.6327209 500.55645,54.9554138 C501.686211,54.2781067 502.991386,53.9394531 504.471977,53.9394531 C506.710258,53.9394531 508.435387,54.5959778 509.647362,55.9090271 C510.859337,57.2220764 511.465324,59.0640259 511.465324,61.4348755 L511.465324,85 L519.310661,85 L519.310661,59.5380859 C519.310661,57.0566406 518.808769,54.8974609 517.804985,53.0605469 C516.801201,51.2236328 515.395226,49.7936707 513.587059,48.7706604 C511.778893,47.7476501 509.65551,47.236145 507.216911,47.236145 C505.452507,47.236145 503.810234,47.5333252 502.290092,48.1276855 C500.769951,48.7220459 499.442802,49.5650635 498.308647,50.6567383 C497.174492,51.7484131 496.291924,53.0570679 495.660942,54.5827026 L495.491203,54.5827026 C495.019524,53.0142212 494.295158,51.6853333 493.318108,50.5960388 C492.341057,49.5067444 491.166435,48.6744385 489.794243,48.0991211 C488.42205,47.5238037 486.88195,47.236145 485.173943,47.236145 C482.75695,47.236145 480.646385,47.8306885 478.842247,49.0197754 C477.038109,50.2088623 475.738152,51.7789917 474.942375,53.7301636 L474.772087,53.7301636 L474.772087,47.9689331 L466.92675,47.9689331 L466.92675,85 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
|
|
28
|
-
<path d="M542.091613,85.7322388 C544.371643,85.7322388 546.429382,85.4251709 548.264831,84.8110352 C550.10028,84.1968994 551.698242,83.3551636 553.058715,82.2858276 C554.419189,81.2164917 555.518554,80.0072632 556.356811,78.6581421 C557.195068,77.309021 557.76416,75.9088135 558.064086,74.4575195 L558.14154,74.0839844 L550.709289,74.0839844 L550.618652,74.3564453 C550.315795,75.2694092 549.789642,76.1067505 549.040191,76.8684692 C548.29074,77.630188 547.345642,78.2393799 546.204895,78.6960449 C545.064147,79.15271 543.749633,79.3810425 542.261352,79.3810425 C540.234008,79.3810425 538.480133,78.9337158 536.999725,78.0390625 C535.519317,77.1444092 534.377471,75.8562622 533.574188,74.1746216 C532.770904,72.492981 532.369262,70.4682007 532.369262,68.1002808 L532.369262,65.0636597 C532.369262,62.5840454 532.774292,60.489502 533.58435,58.7800293 C534.394409,57.0705566 535.506958,55.777832 536.921997,54.9018555 C538.337036,54.0258789 539.943969,53.5878906 541.742797,53.5878906 C543.541625,53.5878906 545.130065,54.0072937 546.508117,54.8460999 C547.886169,55.684906 548.966308,56.9544678 549.748535,58.6547852 C550.530761,60.3551025 550.921875,62.491394 550.921875,65.0636597 L550.921875,68.0854492 L554.755004,62.9817505 L528.427368,62.9817505 L528.427368,68.4661255 L558.540344,68.4661255 L558.540344,65.8354492 C558.540344,62.1206055 557.860382,58.8657227 556.500457,56.0708008 C555.140533,53.2758789 553.200805,51.1047058 550.681274,49.5572815 C548.161743,48.0098572 545.164672,47.236145 541.690063,47.236145 C538.215454,47.236145 535.19522,48.0401611 532.629364,49.6481934 C530.063507,51.2562256 528.074066,53.510437 526.661041,56.4108276 C525.248016,59.3112183 524.541503,62.694458 524.541503,66.5605469 L524.541503,66.5957031 C524.541503,70.4940186 525.244628,73.8772583 526.650878,76.7454224 C528.057128,79.6135864 530.072479,81.8284302 532.696929,83.3899536 C535.32138,84.9514771 538.452941,85.7322388 542.091613,85.7322388 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
|
|
29
|
-
<path d="M563.93182,85 L571.777157,85 L571.777157,63.0449219 C571.777157,61.2032471 572.095761,59.6324768 572.732968,58.3326111 C573.370175,57.0327454 574.284237,56.0410461 575.475155,55.3575134 C576.666073,54.6739807 578.071224,54.3322144 579.690609,54.3322144 C580.440609,54.3322144 581.126614,54.3746948 581.748623,54.4596558 C582.370632,54.5446167 582.837826,54.651001 583.150204,54.7788086 L583.150204,47.5481567 C582.852474,47.4719849 582.470974,47.4009399 582.005703,47.335022 C581.540432,47.269104 581.030941,47.236145 580.47723,47.236145 C578.360897,47.236145 576.556393,47.8670349 575.063717,49.1288147 C573.571041,50.3905945 572.532284,52.1201172 571.947445,54.3173828 L571.777157,54.3173828 L571.777157,47.9689331 L563.93182,47.9689331 L563.93182,85 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
|
|
30
|
-
<path d="M601.861811,85.7322388 C604.87646,85.7322388 607.534877,85.1495056 609.837062,83.9840393 C612.139247,82.818573 613.988063,81.2382812 615.383509,79.2431641 C616.778956,77.2480469 617.606684,75.0024414 617.866694,72.5063477 L617.89416,72.267395 L610.403132,72.267395 L610.34051,72.5634766 C609.898127,74.5487061 608.961085,76.1544495 607.529383,77.3807068 C606.097682,78.6069641 604.220759,79.2200928 601.898616,79.2200928 C599.965022,79.2200928 598.272303,78.7175598 596.82046,77.7124939 C595.368617,76.707428 594.240412,75.2581482 593.435847,73.3646545 C592.631282,71.4711609 592.228999,69.1870117 592.228999,66.512207 L592.228999,66.4770508 C592.228999,63.8626709 592.627894,61.6053467 593.425685,59.7050781 C594.223475,57.8048096 595.343623,56.3370361 596.786128,55.3017578 C598.228633,54.2664795 599.914119,53.7488403 601.842585,53.7488403 C604.298762,53.7488403 606.227778,54.4049072 607.629634,55.717041 C609.031489,57.0291748 609.925776,58.59198 610.312495,60.4054565 L610.375666,60.7009888 L617.838679,60.7009888 L617.810664,60.4345703 C617.606684,58.0849609 616.843592,55.9092102 615.521388,53.9073181 C614.199183,51.905426 612.378657,50.2930908 610.059809,49.0703125 C607.740962,47.8475342 604.982478,47.236145 601.784358,47.236145 C598.248225,47.236145 595.164454,48.0169067 592.533046,49.5784302 C589.901637,51.1399536 587.859645,53.3569946 586.407069,56.2295532 C584.954493,59.1021118 584.228205,62.4968872 584.228205,66.4138794 L584.228205,66.4490356 C584.228205,70.3894653 584.945246,73.8031006 586.379328,76.6899414 C587.813411,79.5767822 589.851924,81.805542 592.494868,83.3762207 C595.137812,84.9468994 598.260127,85.7322388 601.861811,85.7322388 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
|
|
31
|
-
<path d="M638.765004,85.7322388 C641.045033,85.7322388 643.102772,85.4251709 644.938221,84.8110352 C646.773671,84.1968994 648.371632,83.3551636 649.732106,82.2858276 C651.092579,81.2164917 652.191945,80.0072632 653.030201,78.6581421 C653.868458,77.309021 654.43755,75.9088135 654.737477,74.4575195 L654.81493,74.0839844 L647.382679,74.0839844 L647.292042,74.3564453 C646.989186,75.2694092 646.463032,76.1067505 645.713582,76.8684692 C644.964131,77.630188 644.019032,78.2393799 642.878285,78.6960449 C641.737538,79.15271 640.423024,79.3810425 638.934742,79.3810425 C636.907399,79.3810425 635.153523,78.9337158 633.673115,78.0390625 C632.192708,77.1444092 631.050862,75.8562622 630.247578,74.1746216 C629.444294,72.492981 629.042653,70.4682007 629.042653,68.1002808 L629.042653,65.0636597 C629.042653,62.5840454 629.447682,60.489502 630.25774,58.7800293 C631.067799,57.0705566 632.180348,55.777832 633.595387,54.9018555 C635.010426,54.0258789 636.61736,53.5878906 638.416188,53.5878906 C640.215016,53.5878906 641.803456,54.0072937 643.181508,54.8460999 C644.559559,55.684906 645.639699,56.9544678 646.421925,58.6547852 C647.204152,60.3551025 647.595265,62.491394 647.595265,65.0636597 L647.595265,68.0854492 L651.428395,62.9817505 L625.100758,62.9817505 L625.100758,68.4661255 L655.213734,68.4661255 L655.213734,65.8354492 C655.213734,62.1206055 654.533772,58.8657227 653.173848,56.0708008 C651.813923,53.2758789 649.874196,51.1047058 647.354664,49.5572815 C644.835133,48.0098572 641.838063,47.236145 638.363453,47.236145 C634.888844,47.236145 631.868611,48.0401611 629.302754,49.6481934 C626.736897,51.2562256 624.747456,53.510437 623.334431,56.4108276 C621.921406,59.3112183 621.214894,62.694458 621.214894,66.5605469 L621.214894,66.5957031 C621.214894,70.4940186 621.918019,73.8772583 623.324269,76.7454224 C624.730519,79.6135864 626.745869,81.8284302 629.37032,83.3899536 C631.994771,84.9514771 635.126332,85.7322388 638.765004,85.7322388 Z" id="Path" fill="#000000" fill-rule="nonzero"></path>
|
|
32
|
-
<path d="M671.394424,51.3534088 L674.649399,51.3534088 L674.649399,47.5604248 L675.969589,47.5604248 C675.996933,47.5604248 676.026413,47.5604248 676.058029,47.5604248 C676.089645,47.5604248 676.113678,47.5604248 676.130127,47.5604248 L678.175781,51.3534088 L681.842514,51.3534088 L679.425797,47.0323486 C680.050858,46.7554932 680.551056,46.3132935 680.926392,45.7057495 C681.301727,45.0982056 681.489395,44.4350128 681.489395,43.7161713 L681.489395,43.6956635 C681.489395,42.3825226 681.081108,41.3822861 680.264534,40.6949539 C679.44796,40.0076218 678.281204,39.6639557 676.764267,39.6639557 L671.394424,39.6639557 L671.394424,51.3534088 Z M674.665421,45.0703278 L674.665421,42.2863922 L676.392563,42.2863922 C676.925766,42.2863922 677.354401,42.4144592 677.678467,42.6705933 C678.002533,42.9267273 678.164566,43.2641449 678.164566,43.6828461 L678.164566,43.6828461 C678.164566,44.0878754 678.007233,44.4203796 677.692566,44.6803589 C677.377899,44.9403381 676.95108,45.0703278 676.412109,45.0703278 L674.665421,45.0703278 Z M685.098129,45.426651 L685.098129,45.5702057 C685.098129,47.2114716 684.708321,48.6974869 683.928703,50.0282516 C683.149086,51.3590164 682.097313,52.4141541 680.773384,53.1936646 C679.449455,53.973175 677.966965,54.3629303 676.325912,54.3629303 L676.182358,54.3629303 C674.541092,54.3629303 673.055077,53.973175 671.724312,53.1936646 C670.393547,52.4141541 669.338409,51.3590164 668.558899,50.0282516 C667.779388,48.6974869 667.389633,47.2114716 667.389633,45.5702057 L667.389633,45.426651 C667.389633,43.7855988 667.779388,42.3031082 668.558899,40.9791794 C669.338409,39.6552505 670.393547,38.6034775 671.724312,37.8238602 C673.055077,37.0442429 674.541092,36.6544342 676.182358,36.6544342 L676.325912,36.6544342 C677.966965,36.6544342 679.449455,37.0442429 680.773384,37.8238602 C682.097313,38.6034775 683.149086,39.6552505 683.928703,40.9791794 C684.708321,42.3031082 685.098129,43.7855988 685.098129,45.426651 Z M687.846176,45.426651 C687.846176,43.8146515 687.55191,42.3113861 686.963379,40.9168549 C686.374847,39.5223236 685.555069,38.2995453 684.504044,37.2485199 C683.453018,36.1974945 682.23024,35.3777161 680.835709,34.7891846 C679.441177,34.2006531 677.937912,33.9063873 676.325912,33.9063873 L676.182358,33.9063873 C674.570145,33.9063873 673.063354,34.2006531 671.661987,34.7891846 C670.26062,35.3777161 669.034424,36.1974945 667.983398,37.2485199 C666.932373,38.2995453 666.112648,39.5223236 665.524223,40.9168549 C664.935799,42.3113861 664.641586,43.8146515 664.641586,45.426651 L664.641586,45.5702057 C664.641586,47.1824188 664.935799,48.689209 665.524223,50.0905762 C666.112648,51.4919434 666.932373,52.7181396 667.983398,53.769165 C669.034424,54.8201904 670.26062,55.6399155 671.661987,56.2283401 C673.063354,56.8167648 674.570145,57.1109772 676.182358,57.1109772 L676.325912,57.1109772 C677.937912,57.1109772 679.441177,56.8167648 680.835709,56.2283401 C682.23024,55.6399155 683.453018,54.8201904 684.504044,53.769165 C685.555069,52.7181396 686.374847,51.4919434 686.963379,50.0905762 C687.55191,48.689209 687.846176,47.1824188 687.846176,45.5702057 L687.846176,45.426651 Z" id="Shape" fill="#000000" fill-rule="nonzero"></path>
|
|
33
|
-
</g>
|
|
34
|
-
</svg>
|
package/components/Search.tsx
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { iconSearch, IconSvg } from '@graphcommerce/next-ui'
|
|
2
|
-
import { IconButton, TextField, TextFieldProps } from '@mui/material'
|
|
3
|
-
import dynamic from 'next/dynamic'
|
|
4
|
-
import { useState } from 'react'
|
|
5
|
-
|
|
6
|
-
function SearchButton(props: TextFieldProps) {
|
|
7
|
-
return (
|
|
8
|
-
<TextField
|
|
9
|
-
type='input'
|
|
10
|
-
name='query'
|
|
11
|
-
placeholder='Search...'
|
|
12
|
-
InputProps={
|
|
13
|
-
<IconButton size='small'>
|
|
14
|
-
<IconSvg src={iconSearch} />
|
|
15
|
-
</IconButton>
|
|
16
|
-
}
|
|
17
|
-
sx={{ width: '100%', mb: 2 }}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const SearchForm = dynamic(() => import('./SearchForm'), {
|
|
24
|
-
ssr: false,
|
|
25
|
-
loading: () => <SearchButton />,
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
/** Swap SearchButton with SearchForm onFocus */
|
|
29
|
-
export function Search(props: TextFieldProps) {
|
|
30
|
-
const [load, setLoad] = useState(false)
|
|
31
|
-
|
|
32
|
-
const handleFocus = () => setLoad(true)
|
|
33
|
-
|
|
34
|
-
if (!load) return <SearchButton onFocus={handleFocus} {...props} />
|
|
35
|
-
|
|
36
|
-
return <SearchForm {...props} />
|
|
37
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-underscore-dangle */
|
|
2
|
-
import { IconSvg, iconClose, iconSearch } from '@graphcommerce/next-ui'
|
|
3
|
-
import { useForm, useFormAutoSubmit, useFormMuiRegister } from '@graphcommerce/react-hook-form'
|
|
4
|
-
import {
|
|
5
|
-
Box,
|
|
6
|
-
IconButton,
|
|
7
|
-
TextField,
|
|
8
|
-
List,
|
|
9
|
-
ListItemButton,
|
|
10
|
-
ListItemText,
|
|
11
|
-
Divider,
|
|
12
|
-
darken,
|
|
13
|
-
TextFieldProps,
|
|
14
|
-
} from '@mui/material'
|
|
15
|
-
import { Hit, HitAttributeSnippetResult } from 'instantsearch.js'
|
|
16
|
-
import Link from 'next/link'
|
|
17
|
-
import { InstantSearch, useSearchBox } from 'react-instantsearch-hooks'
|
|
18
|
-
import { instantSearchProps, useHits } from '../lib/instantSearch'
|
|
19
|
-
|
|
20
|
-
function Snippet(hit: Hit) {
|
|
21
|
-
if (!hit._snippetResult) return null
|
|
22
|
-
|
|
23
|
-
const snippets = Object.entries(hit._snippetResult)
|
|
24
|
-
.map(([field, snip]) => snip as HitAttributeSnippetResult)
|
|
25
|
-
.filter((snip) => snip.matchLevel !== 'none')
|
|
26
|
-
.map((snip) => snip.value)
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<>
|
|
30
|
-
{snippets.map((snip) => (
|
|
31
|
-
<Box component='span' key={snip} dangerouslySetInnerHTML={{ __html: snip }} sx={{}} />
|
|
32
|
-
))}
|
|
33
|
-
</>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function SearchBox() {
|
|
38
|
-
const { hits, results } = useHits()
|
|
39
|
-
const { query, clear, isSearchStalled, refine } = useSearchBox()
|
|
40
|
-
|
|
41
|
-
const form = useForm<{ query: string }>()
|
|
42
|
-
const { handleSubmit, resetField } = form
|
|
43
|
-
|
|
44
|
-
const muiRegister = useFormMuiRegister(form)
|
|
45
|
-
const submit = handleSubmit((values) => refine(values.query))
|
|
46
|
-
useFormAutoSubmit({ form, submit, wait: 0 })
|
|
47
|
-
|
|
48
|
-
const totalResults = query ? results?.nbHits ?? 0 : 0
|
|
49
|
-
|
|
50
|
-
const endAdornment = !query ? (
|
|
51
|
-
<IconButton size='small'>
|
|
52
|
-
<IconSvg src={iconSearch} />
|
|
53
|
-
</IconButton>
|
|
54
|
-
) : (
|
|
55
|
-
<>
|
|
56
|
-
{totalResults > 0 && (
|
|
57
|
-
<Box sx={{ minWidth: 'max-content', color: 'text.disabled', paddingRight: '7px' }}>
|
|
58
|
-
{totalResults === 1 && <>{totalResults} result</>}
|
|
59
|
-
{totalResults > 1 && <>{totalResults} results</>}
|
|
60
|
-
</Box>
|
|
61
|
-
)}
|
|
62
|
-
<IconButton onClick={() => resetField('query')} size='small'>
|
|
63
|
-
<IconSvg src={iconClose} />
|
|
64
|
-
</IconButton>
|
|
65
|
-
</>
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<Box component='form' onSubmit={submit} sx={{ mb: 2, overflow: 'hidden' }}>
|
|
70
|
-
<TextField
|
|
71
|
-
type='input'
|
|
72
|
-
placeholder='Search...'
|
|
73
|
-
{...muiRegister('query')}
|
|
74
|
-
InputProps={{ endAdornment }}
|
|
75
|
-
sx={{ width: '100%' }}
|
|
76
|
-
/>
|
|
77
|
-
|
|
78
|
-
{isSearchStalled && <div>Searching...</div>}
|
|
79
|
-
|
|
80
|
-
{query && (
|
|
81
|
-
<List dense>
|
|
82
|
-
{hits.map((hit) => (
|
|
83
|
-
<Link key={hit.objectID} href={`/${hit.url}`} passHref>
|
|
84
|
-
<ListItemButton
|
|
85
|
-
dense
|
|
86
|
-
component='a'
|
|
87
|
-
sx={{
|
|
88
|
-
borderRadius: 2,
|
|
89
|
-
'&.Mui-selected': { color: (theme) => darken(theme.palette.primary.main, 0.01) },
|
|
90
|
-
}}
|
|
91
|
-
>
|
|
92
|
-
<ListItemText primary={hit.name} secondary={<Snippet {...hit} />} />
|
|
93
|
-
</ListItemButton>
|
|
94
|
-
</Link>
|
|
95
|
-
))}
|
|
96
|
-
|
|
97
|
-
<Divider variant='middle' sx={{ mt: 2 }} />
|
|
98
|
-
</List>
|
|
99
|
-
)}
|
|
100
|
-
</Box>
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export default function SearchForm(props: TextFieldProps) {
|
|
105
|
-
return (
|
|
106
|
-
<InstantSearch {...instantSearchProps}>
|
|
107
|
-
<SearchBox {...props} />
|
|
108
|
-
</InstantSearch>
|
|
109
|
-
)
|
|
110
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { iconChevronDown, iconChevronUp, IconSvg } from '@graphcommerce/next-ui'
|
|
2
|
-
import {
|
|
3
|
-
Box,
|
|
4
|
-
Collapse,
|
|
5
|
-
List,
|
|
6
|
-
ListItemButton,
|
|
7
|
-
ListItemText,
|
|
8
|
-
darken,
|
|
9
|
-
SxProps,
|
|
10
|
-
Theme,
|
|
11
|
-
} from '@mui/material'
|
|
12
|
-
import NextLink from 'next/link'
|
|
13
|
-
import { useRouter } from 'next/router'
|
|
14
|
-
import React, { useEffect } from 'react'
|
|
15
|
-
import type { FileOrFolderNode, FileNode } from '../../lib/files'
|
|
16
|
-
|
|
17
|
-
function FileLink(props: FileNode & { level: number; selected: string }) {
|
|
18
|
-
const { matter, url, name, level, selected } = props
|
|
19
|
-
const indent = Math.max(0, level + 1) * 2
|
|
20
|
-
|
|
21
|
-
const active = selected === `/${url}`
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<NextLink href={`/${url}`} passHref>
|
|
25
|
-
<ListItemButton
|
|
26
|
-
component='a'
|
|
27
|
-
sx={{
|
|
28
|
-
pl: indent,
|
|
29
|
-
borderRadius: 2,
|
|
30
|
-
'&.Mui-selected': { color: (theme) => darken(theme.palette.primary.main, 0.01) },
|
|
31
|
-
}}
|
|
32
|
-
selected={active}
|
|
33
|
-
dense
|
|
34
|
-
>
|
|
35
|
-
<ListItemText>{matter.menu ?? name}</ListItemText>
|
|
36
|
-
</ListItemButton>
|
|
37
|
-
</NextLink>
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function isSelected(node: FileOrFolderNode, asPath: string): boolean {
|
|
42
|
-
const p = asPath.split('?')[0]
|
|
43
|
-
const { type, childNodes } = node
|
|
44
|
-
|
|
45
|
-
if (type === 'file' && p === `/${node.url}`) return true
|
|
46
|
-
|
|
47
|
-
return childNodes?.some((child) => isSelected(child, p)) ?? false
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function MenuList(props: FileOrFolderNode & { level?: number; selected: string }) {
|
|
51
|
-
const { name, childNodes, type, level = 0, selected } = props
|
|
52
|
-
|
|
53
|
-
const [open, setOpen] = React.useState(isSelected(props, selected))
|
|
54
|
-
|
|
55
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
-
useEffect(() => setOpen(isSelected(props, selected)), [selected])
|
|
57
|
-
|
|
58
|
-
const handleClick = () => setOpen(!open)
|
|
59
|
-
|
|
60
|
-
const indent = Math.max(0, level + 1) * 2
|
|
61
|
-
|
|
62
|
-
const hasChildren = childNodes && childNodes.length
|
|
63
|
-
|
|
64
|
-
if (hasChildren) {
|
|
65
|
-
return (
|
|
66
|
-
<>
|
|
67
|
-
<ListItemButton onClick={handleClick} sx={{ pl: indent, borderRadius: 2 }} dense>
|
|
68
|
-
<ListItemText>{name}</ListItemText>
|
|
69
|
-
{open ? <IconSvg src={iconChevronUp} /> : <IconSvg src={iconChevronDown} />}
|
|
70
|
-
</ListItemButton>
|
|
71
|
-
<Collapse in={open} timeout='auto' unmountOnExit>
|
|
72
|
-
<List component='div' disablePadding>
|
|
73
|
-
{type === 'file' && <FileLink {...props} level={level + 1} />}
|
|
74
|
-
{childNodes?.map((child) => (
|
|
75
|
-
<MenuList key={child.name} {...child} level={level + 1} selected={selected} />
|
|
76
|
-
))}
|
|
77
|
-
</List>
|
|
78
|
-
</Collapse>
|
|
79
|
-
</>
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (type === 'file') {
|
|
84
|
-
return <FileLink {...props} level={level} />
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return null
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export default function SidebarMenu(props: FileNode & { sx?: SxProps<Theme>; selected: string }) {
|
|
91
|
-
const { childNodes, type, sx, selected, ...link } = props
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<List component='nav' disablePadding sx={sx}>
|
|
95
|
-
<FileLink type={type} {...link} level={0} selected={selected} />
|
|
96
|
-
{childNodes?.map((tree) => (
|
|
97
|
-
<MenuList key={tree.path} {...tree} selected={selected} />
|
|
98
|
-
))}
|
|
99
|
-
</List>
|
|
100
|
-
)
|
|
101
|
-
}
|