@shopify/create-hydrogen 1.0.0-alpha.23 → 1.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +238 -0
  2. package/bin/run.cmd +3 -0
  3. package/bin/run.js +7 -0
  4. package/dist/commands/init.js +151818 -0
  5. package/dist/commands/init.js.map +1 -0
  6. package/dist/index.js +145518 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +64 -16
  9. package/templates/template-hydrogen-default/.devcontainer/devcontainer.json +18 -0
  10. package/templates/template-hydrogen-default/.eslintrc.js +3 -0
  11. package/templates/template-hydrogen-default/.gitignore +7 -0
  12. package/{template-hydrogen → templates/template-hydrogen-default}/.stylelintrc.js +1 -1
  13. package/templates/template-hydrogen-default/.vscode/extensions.json +8 -0
  14. package/{template-hydrogen → templates/template-hydrogen-default}/README.md +11 -2
  15. package/{template-hydrogen → templates/template-hydrogen-default}/_gitignore +0 -0
  16. package/templates/template-hydrogen-default/index.html +20 -0
  17. package/templates/template-hydrogen-default/package.json.liquid +48 -0
  18. package/{template-hydrogen → templates/template-hydrogen-default}/postcss.config.js +0 -0
  19. package/templates/template-hydrogen-default/public/favicon.ico +0 -0
  20. package/{template-hydrogen → templates/template-hydrogen-default}/shopify.config.js +1 -2
  21. package/templates/template-hydrogen-default/src/App.server.jsx +27 -0
  22. package/templates/template-hydrogen-default/src/components/Button.client.jsx +65 -0
  23. package/templates/template-hydrogen-default/src/components/Cart.client.jsx +265 -0
  24. package/templates/template-hydrogen-default/src/components/CartIcon.jsx +33 -0
  25. package/templates/template-hydrogen-default/src/components/CartIconWithItems.client.jsx +28 -0
  26. package/templates/template-hydrogen-default/src/components/CartProvider.client.jsx +35 -0
  27. package/templates/template-hydrogen-default/src/components/CartToggle.client.jsx +30 -0
  28. package/templates/template-hydrogen-default/src/components/CartUIProvider.client.jsx +45 -0
  29. package/templates/template-hydrogen-default/src/components/CountrySelector.client.jsx +116 -0
  30. package/templates/template-hydrogen-default/src/components/DefaultSeo.server.jsx +36 -0
  31. package/templates/template-hydrogen-default/src/components/FeaturedCollection.jsx +26 -0
  32. package/templates/template-hydrogen-default/src/components/Footer.server.jsx +103 -0
  33. package/templates/template-hydrogen-default/src/components/Gallery.client.jsx +66 -0
  34. package/templates/template-hydrogen-default/src/components/Header.client.jsx +62 -0
  35. package/templates/template-hydrogen-default/src/components/Layout.server.jsx +86 -0
  36. package/templates/template-hydrogen-default/src/components/LoadMoreProducts.client.jsx +56 -0
  37. package/templates/template-hydrogen-default/src/components/LoadingFallback.jsx +26 -0
  38. package/templates/template-hydrogen-default/src/components/MobileCountrySelector.client.jsx +64 -0
  39. package/templates/template-hydrogen-default/src/components/MobileNavigation.client.jsx +98 -0
  40. package/templates/template-hydrogen-default/src/components/MoneyCompareAtPrice.client.jsx +14 -0
  41. package/templates/template-hydrogen-default/src/components/MoneyPrice.client.jsx +15 -0
  42. package/templates/template-hydrogen-default/src/components/Navigation.client.jsx +23 -0
  43. package/templates/template-hydrogen-default/src/components/NotFound.server.jsx +93 -0
  44. package/templates/template-hydrogen-default/src/components/OpenIcon.jsx +33 -0
  45. package/templates/template-hydrogen-default/src/components/ProductCard.jsx +50 -0
  46. package/templates/template-hydrogen-default/src/components/ProductDetails.client.jsx +233 -0
  47. package/{template-hydrogen → templates/template-hydrogen-default}/src/components/ProductOptions.client.jsx +7 -4
  48. package/templates/template-hydrogen-default/src/components/Welcome.server.jsx +188 -0
  49. package/{template-hydrogen → templates/template-hydrogen-default}/src/index.css +31 -0
  50. package/templates/template-hydrogen-default/src/pages/collections/[handle].server.jsx +105 -0
  51. package/templates/template-hydrogen-default/src/pages/index.server.jsx +241 -0
  52. package/{template-hydrogen → templates/template-hydrogen-default}/src/pages/pages/[handle].server.jsx +14 -5
  53. package/templates/template-hydrogen-default/src/pages/products/[handle].server.jsx +66 -0
  54. package/templates/template-hydrogen-default/src/pages/redirect.server.jsx +4 -0
  55. package/templates/template-hydrogen-default/src/pages/robots.txt.server.js +40 -0
  56. package/templates/template-hydrogen-default/src/pages/sitemap.xml.server.jsx +151 -0
  57. package/templates/template-hydrogen-default/src/routes/collections/[handle].server.jsx +105 -0
  58. package/templates/template-hydrogen-default/src/routes/index.server.jsx +241 -0
  59. package/templates/template-hydrogen-default/src/routes/pages/[handle].server.jsx +37 -0
  60. package/templates/template-hydrogen-default/src/routes/products/[handle].server.jsx +66 -0
  61. package/templates/template-hydrogen-default/src/routes/redirect.server.jsx +4 -0
  62. package/templates/template-hydrogen-default/src/routes/robots.txt.server.js +40 -0
  63. package/templates/template-hydrogen-default/src/routes/sitemap.xml.server.jsx +151 -0
  64. package/templates/template-hydrogen-default/tailwind.config.js +26 -0
  65. package/{template-hydrogen → templates/template-hydrogen-default}/vite.config.js +1 -0
  66. package/templates/template-hydrogen-minimal/README.md +8 -0
  67. package/templates/template-hydrogen-minimal/package.json +14 -0
  68. package/index.js +0 -201
  69. package/scripts/tmp-copy-template-from-dev.js +0 -21
  70. package/scripts/utils.js +0 -29
  71. package/template-hydrogen/.eslintrc.js +0 -41
  72. package/template-hydrogen/.vscode/extensions.json +0 -3
  73. package/template-hydrogen/Dockerfile +0 -15
  74. package/template-hydrogen/index.html +0 -14
  75. package/template-hydrogen/package.json +0 -43
  76. package/template-hydrogen/server.js +0 -40
  77. package/template-hydrogen/src/App.server.jsx +0 -42
  78. package/template-hydrogen/src/components/Cart.client.jsx +0 -287
  79. package/template-hydrogen/src/components/CartProvider.client.jsx +0 -15
  80. package/template-hydrogen/src/components/DefaultSeo.server.jsx +0 -22
  81. package/template-hydrogen/src/components/Footer.jsx +0 -12
  82. package/template-hydrogen/src/components/Gallery.client.jsx +0 -36
  83. package/template-hydrogen/src/components/Header.client.jsx +0 -46
  84. package/template-hydrogen/src/components/HightlightedProduct.client.jsx +0 -54
  85. package/template-hydrogen/src/components/Layout.client.jsx +0 -61
  86. package/template-hydrogen/src/components/MediaPlaceholder.jsx +0 -21
  87. package/template-hydrogen/src/components/NotFound.server.jsx +0 -104
  88. package/template-hydrogen/src/components/ProductCard.client.jsx +0 -39
  89. package/template-hydrogen/src/components/ProductDetails.client.jsx +0 -184
  90. package/template-hydrogen/src/components/Seo.client.jsx +0 -75
  91. package/template-hydrogen/src/entry-client.jsx +0 -12
  92. package/template-hydrogen/src/entry-server.jsx +0 -7
  93. package/template-hydrogen/src/favicon.svg +0 -15
  94. package/template-hydrogen/src/pages/Index.server.jsx +0 -186
  95. package/template-hydrogen/src/pages/blogs/[handle]/[articleHandle].server.jsx +0 -49
  96. package/template-hydrogen/src/pages/blogs/[handle].server.jsx +0 -76
  97. package/template-hydrogen/src/pages/collections/[handle].server.jsx +0 -69
  98. package/template-hydrogen/src/pages/products/[handle].server.jsx +0 -56
  99. package/template-hydrogen/src/pages/search.server.jsx +0 -107
  100. package/template-hydrogen/src/pages/sitemap.xml.server.jsx +0 -64
  101. package/template-hydrogen/tailwind.config.js +0 -9
  102. package/template-hydrogen/worker.js +0 -22
@@ -1,287 +0,0 @@
1
- import {
2
- useCart,
3
- useCartLinesTotalQuantity,
4
- Money,
5
- CartToggle,
6
- CartCheckoutButton,
7
- Link,
8
- CartLines,
9
- CartLine,
10
- CartShopPayButton,
11
- CartTotal,
12
- } from '@shopify/hydrogen/client';
13
-
14
- export default function Cart() {
15
- const itemCount = useCartLinesTotalQuantity();
16
- const {error} = useCart();
17
-
18
- return (
19
- <div className="overflow-hidden md:h-auto pointer-events-auto">
20
- <div className="flex flex-col shadow-xl max-h-full">
21
- <header className="bg-white px-4 md:px-8 md:h-20 border-b border-gray-300 border-solid rounded-t-md flex flex-shrink-0 items-center justify-between">
22
- <CartHeader />
23
- </header>
24
-
25
- <div className="bg-white px-4 md:px-8 overflow-y-scroll md:max-h-96">
26
- {itemCount > 0 ? (
27
- <CartLineItems />
28
- ) : (
29
- <p className="text-center text-gray-600 my-8">Your cart is empty</p>
30
- )}
31
- </div>
32
-
33
- {error ? (
34
- <div
35
- className="border bg-red-200 border-red-400 text-red-800 mb-4 mx-8 px-4 py-3 rounded relative"
36
- role="alert"
37
- >
38
- {error}
39
- </div>
40
- ) : null}
41
-
42
- <footer
43
- className={`${
44
- itemCount > 0 ? 'border-t border-solid border-gray-300' : ''
45
- } bg-white p-4 md:p-8 space-y-4 flex-shrink-0 rounded-b-md`}
46
- >
47
- {itemCount > 0 ? <CartFooter /> : null}
48
- </footer>
49
- </div>
50
- </div>
51
- );
52
- }
53
-
54
- export function CartIcon() {
55
- const itemCount = useCartLinesTotalQuantity();
56
-
57
- return (
58
- <div className="relative">
59
- <svg
60
- width="19"
61
- height="24"
62
- viewBox="0 0 19 24"
63
- fill="none"
64
- xmlns="http://www.w3.org/2000/svg"
65
- >
66
- <path
67
- d="M15.5894 7H3.41063C2.89451 7 2.46318 7.39279 2.415 7.90666L1.205 20.8133C1.09502 21.9865 2.01796 23 3.19627 23H15.8037C16.982 23 17.905 21.9865 17.795 20.8133L16.585 7.90666C16.5368 7.39279 16.1055 7 15.5894 7Z"
68
- stroke="#1F2937"
69
- strokeWidth="2"
70
- strokeMiterlimit="10"
71
- strokeLinecap="round"
72
- />
73
- <path
74
- d="M6 7V9.98952C6 12.0075 7.63589 13.6434 9.65386 13.6434V13.6434C11.6718 13.6434 13.3077 12.0075 13.3077 9.98952V7"
75
- stroke="#1F2937"
76
- strokeWidth="2"
77
- />
78
- <path
79
- d="M13 6L13 4.5C13 2.567 11.433 1 9.5 1V1C7.567 1 6 2.567 6 4.5L6 6"
80
- stroke="#1F2937"
81
- strokeWidth="2"
82
- className={`${itemCount > 0 ? 'block' : 'hidden'}`}
83
- />
84
- </svg>
85
-
86
- <div
87
- className={`bg-blue-600 text-xs rounded-full leading-none text-white absolute bottom-0 right-0 flex items-center justify-center transform translate-y-1/2 transition-all ${
88
- itemCount > 0 ? 'h-4 w-4' : 'h-0 w-0 overflow-hidden'
89
- }`}
90
- >
91
- {itemCount > 0 ? itemCount : null}
92
- </div>
93
- <span className="sr-only">Cart, {itemCount} items</span>
94
- </div>
95
- );
96
- }
97
-
98
- function CartHeader() {
99
- return (
100
- <>
101
- <CartToggle>
102
- <div>
103
- <svg
104
- xmlns="http://www.w3.org/2000/svg"
105
- className="h-5 w-5 text-gray-600"
106
- viewBox="0 0 20 20"
107
- fill="currentColor"
108
- >
109
- <path
110
- fillRule="evenodd"
111
- d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z"
112
- clipRule="evenodd"
113
- />
114
- </svg>
115
- </div>
116
- <span className="sr-only">Close cart</span>
117
- </CartToggle>
118
- <div className="h-12 w-12 p-2 md:h-7 md:w-7 md:p-0">
119
- <CartIcon />
120
- </div>
121
- </>
122
- );
123
- }
124
-
125
- function CartLineItems() {
126
- return (
127
- <div role="table" aria-label="Shopping cart">
128
- <div role="row" className="sr-only">
129
- <div role="columnheader">Image</div>
130
- <div role="columnheader">Item details</div>
131
- <div role="columnheader">Price</div>
132
- </div>
133
- <CartLines>
134
- {({merchandise}) => (
135
- <div
136
- role="row"
137
- className="pt-8 pb-8 border-b border-solid border-gray-300 last:border-0"
138
- >
139
- <div className="flex space-x-8 relative">
140
- <div role="cell">
141
- <div className="w-20 h-20 relative">
142
- <Link to={`/products/${merchandise.product.handle}`}>
143
- <CartLine.Image className="bg-white rounded w-full h-full object-cover" />
144
- </Link>
145
- </div>
146
- </div>
147
- <div
148
- role="cell"
149
- className="flex-grow flex flex-col justify-between"
150
- >
151
- <div className="flex gap-2">
152
- <div className="flex-grow">
153
- <CartLine.ProductTitle className="text-gray-900 font-semibold" />
154
- <CartLine.SelectedOptions className="text-sm">
155
- {({name, value}) => (
156
- <>
157
- {name}: {value}
158
- </>
159
- )}
160
- </CartLine.SelectedOptions>
161
- <CartLine.Attributes className="text-sm">
162
- {({key, value}) => (
163
- <>
164
- {key}: {value}
165
- </>
166
- )}
167
- </CartLine.Attributes>
168
- </div>
169
- <div className="flex-shrink">
170
- <CartLine.QuantityAdjustButton
171
- adjust="remove"
172
- aria-label="Remove from cart"
173
- >
174
- <svg
175
- xmlns="http://www.w3.org/2000/svg"
176
- className="h-5 w-5"
177
- viewBox="0 0 20 20"
178
- fill="currentColor"
179
- >
180
- <path
181
- fillRule="evenodd"
182
- d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
183
- clipRule="evenodd"
184
- />
185
- </svg>
186
- </CartLine.QuantityAdjustButton>
187
- </div>
188
- </div>
189
- <div className="flex mt-2">
190
- <div className="flex-grow">
191
- <div className="border border-solid border-gray-300 inline-flex items-center text-gray-500 rounded">
192
- <CartLine.QuantityAdjustButton
193
- adjust="decrease"
194
- className="p-2"
195
- aria-label="Decrease quantity"
196
- >
197
- <svg
198
- xmlns="http://www.w3.org/2000/svg"
199
- className="h-5 w-5"
200
- viewBox="0 0 20 20"
201
- fill="currentColor"
202
- >
203
- <path
204
- fillRule="evenodd"
205
- d="M5 10a1 1 0 011-1h8a1 1 0 110 2H6a1 1 0 01-1-1z"
206
- clipRule="evenodd"
207
- />
208
- </svg>
209
- </CartLine.QuantityAdjustButton>
210
- <CartLine.Quantity
211
- as="div"
212
- className="p-2 text-gray-900 text-center"
213
- />
214
- <CartLine.QuantityAdjustButton
215
- adjust="increase"
216
- className="p-2"
217
- aria-label="Increase quantity"
218
- >
219
- <svg
220
- xmlns="http://www.w3.org/2000/svg"
221
- className="h-5 w-5"
222
- viewBox="0 0 20 20"
223
- fill="currentColor"
224
- >
225
- <path
226
- fillRule="evenodd"
227
- d="M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z"
228
- clipRule="evenodd"
229
- />
230
- </svg>
231
- </CartLine.QuantityAdjustButton>
232
- </div>
233
- </div>
234
- </div>
235
- <CartLine.Price
236
- role="cell"
237
- className="absolute bottom-0 right-0 mb-3"
238
- />
239
- </div>
240
- </div>
241
- </div>
242
- )}
243
- </CartLines>
244
- </div>
245
- );
246
- }
247
-
248
- function CartFooter() {
249
- const {subtotal} = useCart();
250
-
251
- return (
252
- <>
253
- <div role="table" className="w-full" aria-label="Cost summary">
254
- {subtotal && (
255
- <div role="row" className="flex items-center justify-between">
256
- <div role="rowheader" className="pb-2 font-semibold">
257
- Subtotal
258
- </div>
259
- <div role="cell" className="text-right pb-2">
260
- <Money money={subtotal} />
261
- </div>
262
- </div>
263
- )}
264
- <div role="row" className="flex items-center justify-between">
265
- <div role="rowheader" className="font-semibold">
266
- Shipping
267
- </div>
268
- <div role="cell" className="text-right">
269
- Free
270
- </div>
271
- </div>
272
- <div role="row" className="flex items-center justify-between">
273
- <div role="rowheader" className="font-semibold">
274
- Total
275
- </div>
276
- <CartTotal role="cell" className="text-right" />
277
- </div>
278
- </div>
279
- <div className="space-y-2">
280
- <CartShopPayButton className="flex justify-center w-full" />
281
- <CartCheckoutButton className="block w-full text-white uppercase text-sm rounded-md md:mb-8 bg-black px-3 py-4 disabled:cursor-wait disabled:opacity-60">
282
- Checkout
283
- </CartCheckoutButton>
284
- </div>
285
- </>
286
- );
287
- }
@@ -1,15 +0,0 @@
1
- import {CartProvider as ShopifyCartProvider} from '@shopify/hydrogen/client';
2
-
3
- /**
4
- * TODO: Remove this re-export once we find a long-term solution for
5
- * mixed Hydrogen Client Components.
6
- * @see https://github.com/Shopify/hydrogen/issues/383
7
- */
8
-
9
- export default function CartProvider({children, cart, numCartLines}) {
10
- return (
11
- <ShopifyCartProvider cart={cart} numCartLines={numCartLines}>
12
- {children}
13
- </ShopifyCartProvider>
14
- );
15
- }
@@ -1,22 +0,0 @@
1
- import {useShopQuery} from '@shopify/hydrogen';
2
- import gql from 'graphql-tag';
3
-
4
- import Seo from './Seo.client';
5
-
6
- export default function SeoServer() {
7
- const {
8
- data: {
9
- shop: {name: shopName},
10
- },
11
- } = useShopQuery({query: QUERY});
12
-
13
- return <Seo shopName={shopName} />;
14
- }
15
-
16
- const QUERY = gql`
17
- query shopName {
18
- shop {
19
- name
20
- }
21
- }
22
- `;
@@ -1,12 +0,0 @@
1
- export default function Footer() {
2
- return (
3
- <footer
4
- role="contentinfo"
5
- className="flex items-center justify-between p-4 md:py-8 md:px-8 max-w-7xl mx-auto"
6
- >
7
- <p className="text-gray-600">© 2021 Shopify</p>
8
- <div>{/* TODO: Payment icons */}</div>
9
- <p className="text-gray-400">Powered by Shopify</p>
10
- </footer>
11
- );
12
- }
@@ -1,36 +0,0 @@
1
- import {useProduct, MediaFile} from '@shopify/hydrogen/client';
2
-
3
- export default function Gallery() {
4
- return (
5
- <>
6
- <GalleryPreview />
7
- </>
8
- );
9
- }
10
-
11
- function GalleryPreview() {
12
- const {media} = useProduct();
13
-
14
- if (!media.length) {
15
- return null;
16
- }
17
-
18
- return (
19
- <ul className="grid lg:grid-cols-2 gap-10">
20
- {media.map((med) => {
21
- return (
22
- <li key={med.id} className="relative">
23
- <MediaFile
24
- className="w-full bg-white rounded-md object-cover"
25
- media={med}
26
- options={{
27
- height: '1000',
28
- crop: 'center',
29
- }}
30
- />
31
- </li>
32
- );
33
- })}
34
- </ul>
35
- );
36
- }
@@ -1,46 +0,0 @@
1
- import {Link, CartToggle} from '@shopify/hydrogen/client';
2
-
3
- import {CartIcon} from './Cart.client';
4
-
5
- export default function Header() {
6
- return (
7
- <header
8
- className="z-10 relative flex items-center justify-between pt-3 md:pt-12 md:pb-4 md:px-8 max-w-7xl mx-auto"
9
- role="banner"
10
- >
11
- <nav>
12
- <ul className="hidden md:flex items-center justify-center space-x-6 font-medium relative">
13
- <li>
14
- <Link to="/">Home</Link>
15
- </li>
16
- <li>
17
- <Link to="/" className="flex items-center justify-center">
18
- Collections
19
- <svg
20
- xmlns="http://www.w3.org/2000/svg"
21
- className="h-5 w-5"
22
- viewBox="0 0 20 20"
23
- fill="currentColor"
24
- >
25
- <path
26
- fillRule="evenodd"
27
- d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
28
- clipRule="evenodd"
29
- />
30
- </svg>
31
- </Link>
32
- </li>
33
- </ul>
34
- </nav>
35
- <Link
36
- className="text-center font-bold uppercase text-2xl tracking-widest absolute left-1/2 transform -translate-x-1/2"
37
- to="/"
38
- >
39
- My Shop
40
- </Link>
41
- <CartToggle className="h-12 w-12 p-2 mr-2 md:mr-0 md:h-7 md:w-7 md:p-0">
42
- <CartIcon />
43
- </CartToggle>
44
- </header>
45
- );
46
- }
@@ -1,54 +0,0 @@
1
- import {
2
- ProductProvider,
3
- SelectedVariantImage,
4
- ProductTitle,
5
- SelectedVariantPrice,
6
- SelectedVariantAddToCartButton,
7
- Link,
8
- } from '@shopify/hydrogen/client';
9
-
10
- import ProductOptions from './ProductOptions.client';
11
-
12
- export default function HighlightedProduct({product}) {
13
- if (!product) {
14
- return null;
15
- }
16
-
17
- return (
18
- <ProductProvider
19
- product={product}
20
- initialVariantId={product.variants.edges[0].node.id}
21
- >
22
- <SelectedVariantImage className="rounded-md bg-gray-100 w-full md:min-h-96 md:w-96 object-cover" />
23
- <div className="pt-4 md:pl-10 w-full flex flex-col">
24
- <Link to={`/products/${product.handle}`}>
25
- <ProductTitle className="text-gray-900 text-xl md:text-3xl font-medium" />
26
- </Link>
27
- <div className="my-2 md:my-4 md:mb-16">
28
- <SelectedVariantPrice className="font-semibold md:font-medium text-gray-900 md:text-xl">
29
- {({currencyCode, amount, currencyNarrowSymbol}) => {
30
- return (
31
- <span>{`${currencyCode} ${currencyNarrowSymbol}${amount}`}</span>
32
- );
33
- }}
34
- </SelectedVariantPrice>
35
- <SelectedVariantPrice
36
- priceType="compareAt"
37
- className="text-gray-400 line-through md:text-xl"
38
- >
39
- {({amount, currencyNarrowSymbol}) => {
40
- return <span>{`${currencyNarrowSymbol}${amount}`}</span>;
41
- }}
42
- </SelectedVariantPrice>
43
- </div>
44
- <ProductOptions />
45
- <SelectedVariantAddToCartButton className="rounded-md bg-gray-900 text-white text-center p-4 text-sm uppercase w-full mt-4 mb-2">
46
- Add to bag
47
- </SelectedVariantAddToCartButton>
48
- <p className="text-gray-500 text-xs text-center">
49
- Free shipping and 30 day returns
50
- </p>
51
- </div>
52
- </ProductProvider>
53
- );
54
- }
@@ -1,61 +0,0 @@
1
- import {
2
- CartUIProvider,
3
- CartContainer,
4
- useCartUI,
5
- } from '@shopify/hydrogen/client';
6
-
7
- import Header from './Header.client';
8
- import Footer from './Footer';
9
- import Cart from './Cart.client';
10
-
11
- export default function Layout({children}) {
12
- return (
13
- <CartUIProvider>
14
- <InnerLayout>{children}</InnerLayout>
15
- </CartUIProvider>
16
- );
17
- }
18
-
19
- function InnerLayout({children}) {
20
- const {isCartOpen, closeCart} = useCartUI();
21
-
22
- return (
23
- <>
24
- <div className="absolute top-0 left-0">
25
- <a
26
- href="#mainContent"
27
- className="p-4 focus:block sr-only focus:not-sr-only"
28
- >
29
- Skip to content
30
- </a>
31
- </div>
32
- <div className="min-h-screen max-w-screen text-gray-700">
33
- <Header />
34
- {/* eslint-disable-next-line @shopify/jsx-prefer-fragment-wrappers */}
35
- <div>
36
- <div
37
- className={`z-50 fixed top-0 bottom-0 left-0 right-0 bg-black transition-opacity duration-400 ${
38
- isCartOpen ? 'opacity-20' : 'opacity-0 pointer-events-none'
39
- }`}
40
- onClick={isCartOpen ? closeCart : null}
41
- />
42
- <CartContainer
43
- id="cart"
44
- className={`pointer-events-none z-50 fixed right-0 top-0 bottom-0 md:p-5 flex flex-col w-full max-w-md min-w-sm transition-transform duration-500 transform-gpu ${
45
- isCartOpen ? 'right-0' : 'translate-x-full'
46
- }`}
47
- >
48
- <Cart />
49
- </CartContainer>
50
- </div>
51
- <main
52
- id="mainContent"
53
- className="mx-auto max-w-7xl p-4 md:py-5 md:px-8"
54
- >
55
- {children}
56
- </main>
57
- <Footer />
58
- </div>
59
- </>
60
- );
61
- }
@@ -1,21 +0,0 @@
1
- export default function MediaPlaceholder({text}) {
2
- return (
3
- <div className="text-gray-500 h-full w-full p-4 bg-gray-200 flex flex-col items-center justify-center space-y-4">
4
- <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- className="h-10 w-10"
7
- fill="none"
8
- viewBox="0 0 24 24"
9
- stroke="currentColor"
10
- >
11
- <path
12
- strokeLinecap="round"
13
- strokeLinejoin="round"
14
- strokeWidth={2}
15
- d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
16
- />
17
- </svg>
18
- {text && <p className="text-sm max-w-xs text-center">{text}</p>}
19
- </div>
20
- );
21
- }
@@ -1,104 +0,0 @@
1
- import {useShopQuery, MediaFile} from '@shopify/hydrogen';
2
- import {Link} from '@shopify/hydrogen/client';
3
- import gql from 'graphql-tag';
4
-
5
- import Layout from './Layout.client';
6
- import ProductCard from './ProductCard.client';
7
-
8
- export default function NotFound() {
9
- const {data} = useShopQuery({query: QUERY});
10
- const {products} = data;
11
-
12
- return (
13
- <Layout>
14
- <div className="text-center py-10 md:py-40 max-w-2xl mx-auto space-y-6">
15
- <h1 className="text-4xl font-extrabold leading-tight">
16
- We’ve lost this page
17
- </h1>
18
- <p className="text-xl text-gray-500">
19
- We couldn’t find the page you’re looking for. Try checking the URL or
20
- heading back to the home page.
21
- </p>
22
- <Link
23
- className="block max-w-md mx-auto text-white p-3 rounded mb-8 uppercase text-lg bg-black"
24
- to="/"
25
- >
26
- Take me to the home page
27
- </Link>
28
- </div>
29
-
30
- <hr className="border-gray-300" />
31
-
32
- <h2 className="my-8 text-2xl text-gray-700 font-bold">
33
- Products you might like
34
- </h2>
35
-
36
- <ul className="grid lg:grid-cols-3 gap-6 my-4">
37
- {products.edges.map((edge) => (
38
- <li key={edge.node.id}>
39
- <ProductCard product={edge.node} />
40
- </li>
41
- ))}
42
- </ul>
43
- </Layout>
44
- );
45
- }
46
-
47
- const QUERY = gql`
48
- fragment NotFoundProductDetails on Product {
49
- id
50
- title
51
- handle
52
- priceRange {
53
- maxVariantPrice {
54
- amount
55
- currencyCode
56
- }
57
- minVariantPrice {
58
- amount
59
- currencyCode
60
- }
61
- }
62
- variants(first: 1) {
63
- edges {
64
- node {
65
- priceV2 {
66
- currencyCode
67
- amount
68
- }
69
- compareAtPriceV2 {
70
- currencyCode
71
- amount
72
- }
73
- image {
74
- ...ImageFragment
75
- }
76
- selectedOptions {
77
- name
78
- value
79
- }
80
- }
81
- }
82
- }
83
- media(first: 1) {
84
- edges {
85
- node {
86
- ...MediaFileFragment
87
- }
88
- }
89
- }
90
- }
91
-
92
- query Products {
93
- products(first: 3) {
94
- edges {
95
- node {
96
- id
97
- ...NotFoundProductDetails
98
- }
99
- }
100
- }
101
- }
102
-
103
- ${MediaFile.Fragment}
104
- `;