@shopify/create-hydrogen 1.0.0-alpha.23 → 1.0.4
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 +256 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +7 -0
- package/dist/commands/init.js +157943 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/index.js +151598 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -16
- package/templates/template-hydrogen-default/.devcontainer/devcontainer.json +18 -0
- package/templates/template-hydrogen-default/.eslintrc.js +3 -0
- package/templates/template-hydrogen-default/.gitignore +7 -0
- package/{template-hydrogen → templates/template-hydrogen-default}/.stylelintrc.js +1 -1
- package/templates/template-hydrogen-default/.vscode/extensions.json +8 -0
- package/{template-hydrogen → templates/template-hydrogen-default}/README.md +11 -2
- package/{template-hydrogen → templates/template-hydrogen-default}/_gitignore +0 -0
- package/templates/template-hydrogen-default/index.html +20 -0
- package/templates/template-hydrogen-default/package.json.liquid +48 -0
- package/{template-hydrogen → templates/template-hydrogen-default}/postcss.config.js +0 -0
- package/templates/template-hydrogen-default/public/favicon.ico +0 -0
- package/{template-hydrogen → templates/template-hydrogen-default}/shopify.config.js +1 -2
- package/templates/template-hydrogen-default/src/App.server.jsx +27 -0
- package/templates/template-hydrogen-default/src/components/Button.client.jsx +65 -0
- package/templates/template-hydrogen-default/src/components/Cart.client.jsx +265 -0
- package/templates/template-hydrogen-default/src/components/CartIcon.jsx +33 -0
- package/templates/template-hydrogen-default/src/components/CartIconWithItems.client.jsx +28 -0
- package/templates/template-hydrogen-default/src/components/CartProvider.client.jsx +35 -0
- package/templates/template-hydrogen-default/src/components/CartToggle.client.jsx +30 -0
- package/templates/template-hydrogen-default/src/components/CartUIProvider.client.jsx +45 -0
- package/templates/template-hydrogen-default/src/components/CountrySelector.client.jsx +116 -0
- package/templates/template-hydrogen-default/src/components/DefaultSeo.server.jsx +36 -0
- package/templates/template-hydrogen-default/src/components/FeaturedCollection.jsx +26 -0
- package/templates/template-hydrogen-default/src/components/Footer.server.jsx +103 -0
- package/templates/template-hydrogen-default/src/components/Gallery.client.jsx +66 -0
- package/templates/template-hydrogen-default/src/components/Header.client.jsx +62 -0
- package/templates/template-hydrogen-default/src/components/Layout.server.jsx +86 -0
- package/templates/template-hydrogen-default/src/components/LoadMoreProducts.client.jsx +56 -0
- package/templates/template-hydrogen-default/src/components/LoadingFallback.jsx +26 -0
- package/templates/template-hydrogen-default/src/components/MobileCountrySelector.client.jsx +64 -0
- package/templates/template-hydrogen-default/src/components/MobileNavigation.client.jsx +98 -0
- package/templates/template-hydrogen-default/src/components/MoneyCompareAtPrice.client.jsx +14 -0
- package/templates/template-hydrogen-default/src/components/MoneyPrice.client.jsx +15 -0
- package/templates/template-hydrogen-default/src/components/Navigation.client.jsx +23 -0
- package/templates/template-hydrogen-default/src/components/NotFound.server.jsx +93 -0
- package/templates/template-hydrogen-default/src/components/OpenIcon.jsx +33 -0
- package/templates/template-hydrogen-default/src/components/ProductCard.jsx +50 -0
- package/templates/template-hydrogen-default/src/components/ProductDetails.client.jsx +233 -0
- package/{template-hydrogen → templates/template-hydrogen-default}/src/components/ProductOptions.client.jsx +7 -4
- package/templates/template-hydrogen-default/src/components/Welcome.server.jsx +188 -0
- package/{template-hydrogen → templates/template-hydrogen-default}/src/index.css +31 -0
- package/templates/template-hydrogen-default/src/pages/collections/[handle].server.jsx +105 -0
- package/templates/template-hydrogen-default/src/pages/index.server.jsx +241 -0
- package/{template-hydrogen → templates/template-hydrogen-default}/src/pages/pages/[handle].server.jsx +14 -5
- package/templates/template-hydrogen-default/src/pages/products/[handle].server.jsx +66 -0
- package/templates/template-hydrogen-default/src/pages/redirect.server.jsx +4 -0
- package/templates/template-hydrogen-default/src/pages/robots.txt.server.js +40 -0
- package/templates/template-hydrogen-default/src/pages/sitemap.xml.server.jsx +151 -0
- package/templates/template-hydrogen-default/src/routes/collections/[handle].server.jsx +105 -0
- package/templates/template-hydrogen-default/src/routes/index.server.jsx +241 -0
- package/templates/template-hydrogen-default/src/routes/pages/[handle].server.jsx +37 -0
- package/templates/template-hydrogen-default/src/routes/products/[handle].server.jsx +66 -0
- package/templates/template-hydrogen-default/src/routes/redirect.server.jsx +4 -0
- package/templates/template-hydrogen-default/src/routes/robots.txt.server.js +40 -0
- package/templates/template-hydrogen-default/src/routes/sitemap.xml.server.jsx +151 -0
- package/templates/template-hydrogen-default/tailwind.config.js +26 -0
- package/{template-hydrogen → templates/template-hydrogen-default}/vite.config.js +1 -0
- package/templates/template-hydrogen-minimal/README.md +8 -0
- package/templates/template-hydrogen-minimal/package.json +14 -0
- package/index.js +0 -201
- package/scripts/tmp-copy-template-from-dev.js +0 -21
- package/scripts/utils.js +0 -29
- package/template-hydrogen/.eslintrc.js +0 -41
- package/template-hydrogen/.vscode/extensions.json +0 -3
- package/template-hydrogen/Dockerfile +0 -15
- package/template-hydrogen/index.html +0 -14
- package/template-hydrogen/package.json +0 -43
- package/template-hydrogen/server.js +0 -40
- package/template-hydrogen/src/App.server.jsx +0 -42
- package/template-hydrogen/src/components/Cart.client.jsx +0 -287
- package/template-hydrogen/src/components/CartProvider.client.jsx +0 -15
- package/template-hydrogen/src/components/DefaultSeo.server.jsx +0 -22
- package/template-hydrogen/src/components/Footer.jsx +0 -12
- package/template-hydrogen/src/components/Gallery.client.jsx +0 -36
- package/template-hydrogen/src/components/Header.client.jsx +0 -46
- package/template-hydrogen/src/components/HightlightedProduct.client.jsx +0 -54
- package/template-hydrogen/src/components/Layout.client.jsx +0 -61
- package/template-hydrogen/src/components/MediaPlaceholder.jsx +0 -21
- package/template-hydrogen/src/components/NotFound.server.jsx +0 -104
- package/template-hydrogen/src/components/ProductCard.client.jsx +0 -39
- package/template-hydrogen/src/components/ProductDetails.client.jsx +0 -184
- package/template-hydrogen/src/components/Seo.client.jsx +0 -75
- package/template-hydrogen/src/entry-client.jsx +0 -12
- package/template-hydrogen/src/entry-server.jsx +0 -7
- package/template-hydrogen/src/favicon.svg +0 -15
- package/template-hydrogen/src/pages/Index.server.jsx +0 -186
- package/template-hydrogen/src/pages/blogs/[handle]/[articleHandle].server.jsx +0 -49
- package/template-hydrogen/src/pages/blogs/[handle].server.jsx +0 -76
- package/template-hydrogen/src/pages/collections/[handle].server.jsx +0 -69
- package/template-hydrogen/src/pages/products/[handle].server.jsx +0 -56
- package/template-hydrogen/src/pages/search.server.jsx +0 -107
- package/template-hydrogen/src/pages/sitemap.xml.server.jsx +0 -64
- package/template-hydrogen/tailwind.config.js +0 -9
- package/template-hydrogen/worker.js +0 -22
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Link,
|
|
3
|
-
ProductProvider,
|
|
4
|
-
ProductTitle,
|
|
5
|
-
SelectedVariantImage,
|
|
6
|
-
SelectedVariantPrice,
|
|
7
|
-
} from '@shopify/hydrogen/client';
|
|
8
|
-
|
|
9
|
-
export default function ProductCard({product}) {
|
|
10
|
-
const firstVariant = product?.variants?.edges[0]?.node;
|
|
11
|
-
|
|
12
|
-
if (!product) return null;
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<ProductProvider product={product} initialVariantId={firstVariant.id}>
|
|
16
|
-
<Link to={`/products/${product.handle}`}>
|
|
17
|
-
<SelectedVariantImage className="rounded-md bg-gray-100 h-80 w-96 mb-2" />
|
|
18
|
-
<ProductTitle className="text-gray-900 font-medium" />
|
|
19
|
-
</Link>
|
|
20
|
-
<div className="flex items-center">
|
|
21
|
-
<SelectedVariantPrice className="text-gray-900">
|
|
22
|
-
{({currencyCode, amount, currencyNarrowSymbol}) => {
|
|
23
|
-
return (
|
|
24
|
-
<span>{`${currencyCode} ${currencyNarrowSymbol}${amount}`}</span>
|
|
25
|
-
);
|
|
26
|
-
}}
|
|
27
|
-
</SelectedVariantPrice>
|
|
28
|
-
<SelectedVariantPrice
|
|
29
|
-
priceType="compareAt"
|
|
30
|
-
className="text-gray-400 line-through"
|
|
31
|
-
>
|
|
32
|
-
{({amount, currencyNarrowSymbol}) => {
|
|
33
|
-
return <span>{`${currencyNarrowSymbol}${amount}`}</span>;
|
|
34
|
-
}}
|
|
35
|
-
</SelectedVariantPrice>
|
|
36
|
-
</div>
|
|
37
|
-
</ProductProvider>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import {Product} from '@shopify/hydrogen/client';
|
|
2
|
-
|
|
3
|
-
import Layout from './Layout.client';
|
|
4
|
-
import ProductOptions from './ProductOptions.client';
|
|
5
|
-
import Gallery from './Gallery.client';
|
|
6
|
-
import Seo from './Seo.client';
|
|
7
|
-
|
|
8
|
-
export default function ProductDetails({data}) {
|
|
9
|
-
return (
|
|
10
|
-
<Layout>
|
|
11
|
-
<Seo product={data.product} />
|
|
12
|
-
<Product
|
|
13
|
-
product={data.product}
|
|
14
|
-
initialVariantId={data.product.variants.edges[0].node.id}
|
|
15
|
-
>
|
|
16
|
-
<div className="py-4 md:grid md:grid-cols-2 lg:grid-cols-3 gap-12">
|
|
17
|
-
<div className="md:hidden pb-4 flex justify-between items-top">
|
|
18
|
-
<Product.Title as="h1" className="font-bold text-2xl" />
|
|
19
|
-
<div className="flex items-center gap-1">
|
|
20
|
-
<Product.SelectedVariant.Price className="text-xl" />
|
|
21
|
-
<Product.SelectedVariant.Price
|
|
22
|
-
priceType="compareAt"
|
|
23
|
-
className="line-through text-gray-400"
|
|
24
|
-
/>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<section className="lg:col-span-2 grid gap-10" aria-label="Gallery">
|
|
29
|
-
<Gallery />
|
|
30
|
-
</section>
|
|
31
|
-
|
|
32
|
-
<section
|
|
33
|
-
className="my-4 md:my-0 max-w-md flex flex-col gap-6"
|
|
34
|
-
aria-label="Product details"
|
|
35
|
-
>
|
|
36
|
-
{/* eslint-disable-next-line @shopify/jsx-prefer-fragment-wrappers */}
|
|
37
|
-
<div>
|
|
38
|
-
<Product.Title className="text-gray-900 text-3xl font-medium" />
|
|
39
|
-
|
|
40
|
-
<Product.Metafield
|
|
41
|
-
namespace="reviews"
|
|
42
|
-
keyName="rating"
|
|
43
|
-
className="text-yellow-500 text-lg"
|
|
44
|
-
/>
|
|
45
|
-
|
|
46
|
-
<div className="my-4 gap-1 hidden md:block">
|
|
47
|
-
<Product.SelectedVariant.Price className="font-semibold text-gray-900 text-2xl">
|
|
48
|
-
{({currencyCode, amount, currencyNarrowSymbol}) => {
|
|
49
|
-
return (
|
|
50
|
-
<span>{`${currencyCode} ${currencyNarrowSymbol}${amount}`}</span>
|
|
51
|
-
);
|
|
52
|
-
}}
|
|
53
|
-
</Product.SelectedVariant.Price>
|
|
54
|
-
<Product.SelectedVariant.Price
|
|
55
|
-
priceType="compareAt"
|
|
56
|
-
className="text-gray-400 line-through text-xl"
|
|
57
|
-
>
|
|
58
|
-
{({amount, currencyNarrowSymbol}) => {
|
|
59
|
-
return <span>{`${currencyNarrowSymbol}${amount}`}</span>;
|
|
60
|
-
}}
|
|
61
|
-
</Product.SelectedVariant.Price>
|
|
62
|
-
|
|
63
|
-
<Product.SelectedVariant.UnitPrice className="text-gray-900 text-base">
|
|
64
|
-
{({
|
|
65
|
-
currencyCode,
|
|
66
|
-
amount,
|
|
67
|
-
currencyNarrowSymbol,
|
|
68
|
-
referenceUnit,
|
|
69
|
-
}) => {
|
|
70
|
-
return (
|
|
71
|
-
<span>{`${currencyCode} ${currencyNarrowSymbol}${amount}/${referenceUnit}`}</span>
|
|
72
|
-
);
|
|
73
|
-
}}
|
|
74
|
-
</Product.SelectedVariant.UnitPrice>
|
|
75
|
-
|
|
76
|
-
<Product.SelectedVariant.Metafield
|
|
77
|
-
namespace="my_fields"
|
|
78
|
-
keyName="no_tax"
|
|
79
|
-
>
|
|
80
|
-
{({value}) => {
|
|
81
|
-
return value ? <span>We pay the tax!</span> : null;
|
|
82
|
-
}}
|
|
83
|
-
</Product.SelectedVariant.Metafield>
|
|
84
|
-
</div>
|
|
85
|
-
|
|
86
|
-
<ProductOptions />
|
|
87
|
-
|
|
88
|
-
<div className="my-8 space-y-2">
|
|
89
|
-
<Product.SelectedVariant.AddToCartButton className="rounded-md bg-gray-900 text-white text-center p-4 text-sm uppercase w-full">
|
|
90
|
-
Add to bag
|
|
91
|
-
</Product.SelectedVariant.AddToCartButton>
|
|
92
|
-
<Product.SelectedVariant.BuyNowButton className="rounded-md bg-white border border-black text-center p-4 text-sm uppercase w-full">
|
|
93
|
-
Buy it now
|
|
94
|
-
</Product.SelectedVariant.BuyNowButton>
|
|
95
|
-
<Product.SelectedVariant.ShopPayButton className="flex justify-center w-full" />
|
|
96
|
-
</div>
|
|
97
|
-
|
|
98
|
-
<ul className="flex gap-2">
|
|
99
|
-
<Product.Metafield
|
|
100
|
-
namespace="my_fields"
|
|
101
|
-
keyName="made_in_canada"
|
|
102
|
-
>
|
|
103
|
-
{({value}) => {
|
|
104
|
-
return value ? (
|
|
105
|
-
<li className="uppercase text-xs bg-red-500 text-white text-center font-semibold rounded-full h-20 w-20 flex items-center justify-center p-3">
|
|
106
|
-
Made in Canada
|
|
107
|
-
</li>
|
|
108
|
-
) : null;
|
|
109
|
-
}}
|
|
110
|
-
</Product.Metafield>
|
|
111
|
-
<Product.Metafield namespace="my_fields" keyName="flex">
|
|
112
|
-
{({value}) => {
|
|
113
|
-
return (
|
|
114
|
-
<li className="uppercase bg-gray-600 text-white text-center font-semibold rounded-full h-20 w-20 flex flex-col items-center justify-center p-3">
|
|
115
|
-
<span className="text-xs">Flex</span>
|
|
116
|
-
<span className="text-4xl">{value}</span>
|
|
117
|
-
</li>
|
|
118
|
-
);
|
|
119
|
-
}}
|
|
120
|
-
</Product.Metafield>
|
|
121
|
-
</ul>
|
|
122
|
-
|
|
123
|
-
<Product.Description className="prose" />
|
|
124
|
-
|
|
125
|
-
<section className="mt-4">
|
|
126
|
-
<h3 className="text-lg font-semibold">Care Guide</h3>
|
|
127
|
-
<Product.Metafield
|
|
128
|
-
namespace="descriptors"
|
|
129
|
-
keyName="care_guide"
|
|
130
|
-
/>
|
|
131
|
-
</section>
|
|
132
|
-
|
|
133
|
-
<section className="mt-4">
|
|
134
|
-
<h3 className="text-lg font-semibold">Specs</h3>
|
|
135
|
-
<ul>
|
|
136
|
-
<li>
|
|
137
|
-
Weight:{' '}
|
|
138
|
-
<Product.Metafield
|
|
139
|
-
namespace="my_fields"
|
|
140
|
-
keyName="product_weight"
|
|
141
|
-
/>
|
|
142
|
-
</li>
|
|
143
|
-
<li>
|
|
144
|
-
Length:{' '}
|
|
145
|
-
<Product.Metafield namespace="my_fields" keyName="length" />
|
|
146
|
-
</li>
|
|
147
|
-
<li>
|
|
148
|
-
Width:{' '}
|
|
149
|
-
<Product.Metafield namespace="my_fields" keyName="width" />
|
|
150
|
-
</li>
|
|
151
|
-
<li>
|
|
152
|
-
Manufactured on:{' '}
|
|
153
|
-
<Product.Metafield
|
|
154
|
-
namespace="my_fields"
|
|
155
|
-
keyName="manufacture_date"
|
|
156
|
-
/>
|
|
157
|
-
</li>
|
|
158
|
-
<li>
|
|
159
|
-
Manufactured by:{' '}
|
|
160
|
-
<Product.Metafield
|
|
161
|
-
namespace="my_fields"
|
|
162
|
-
keyName="manufacturer_url"
|
|
163
|
-
>
|
|
164
|
-
{({value}) => {
|
|
165
|
-
return (
|
|
166
|
-
<a href={value} className="inline-block">
|
|
167
|
-
<Product.Metafield
|
|
168
|
-
namespace="my_fields"
|
|
169
|
-
keyName="manufacturer_name"
|
|
170
|
-
/>
|
|
171
|
-
</a>
|
|
172
|
-
);
|
|
173
|
-
}}
|
|
174
|
-
</Product.Metafield>
|
|
175
|
-
</li>
|
|
176
|
-
</ul>
|
|
177
|
-
</section>
|
|
178
|
-
</div>
|
|
179
|
-
</section>
|
|
180
|
-
</div>
|
|
181
|
-
</Product>
|
|
182
|
-
</Layout>
|
|
183
|
-
);
|
|
184
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import {useShop, Helmet} from '@shopify/hydrogen/client';
|
|
2
|
-
|
|
3
|
-
export default function Seo({shopName, product}) {
|
|
4
|
-
const {locale} = useShop();
|
|
5
|
-
const lang = locale.split(/[-_]/)[0];
|
|
6
|
-
|
|
7
|
-
if (product) {
|
|
8
|
-
const variant = product.variants.edges[0].node;
|
|
9
|
-
const price = variant.priceV2;
|
|
10
|
-
const image = product.images.edges[0]?.node;
|
|
11
|
-
const title = product.seo?.title ?? product.title;
|
|
12
|
-
const description = product.seo?.description ?? product.description;
|
|
13
|
-
|
|
14
|
-
/* TODO: Find a way to get the full URL */
|
|
15
|
-
const url = typeof window === 'undefined' ? '' : window.location.href;
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Helmet>
|
|
19
|
-
<title>{title}</title>
|
|
20
|
-
<meta name="description" content={description} />
|
|
21
|
-
{url && <meta property="og:url" content={url} />}
|
|
22
|
-
<meta property="og:title" content={title} />
|
|
23
|
-
<meta property="og:type" content="product" />
|
|
24
|
-
<meta property="og:description" content={description} />
|
|
25
|
-
<meta property="og:price:amount" content={price.amount} />
|
|
26
|
-
<meta property="og:price:currency" content={price.currencyCode} />
|
|
27
|
-
|
|
28
|
-
{image && <meta property="og:image" content={image.originalSrc} />}
|
|
29
|
-
{image && (
|
|
30
|
-
<meta property="og:image:secure_url" content={image.originalSrc} />
|
|
31
|
-
)}
|
|
32
|
-
|
|
33
|
-
<meta name="twitter:card" content="summary_large_image" />
|
|
34
|
-
<meta name="twitter:title" content={title} />
|
|
35
|
-
<meta name="twitter:description" content={description} />
|
|
36
|
-
|
|
37
|
-
<script type="application/ld+json">{`
|
|
38
|
-
{
|
|
39
|
-
"@context": "https://schema.org/",
|
|
40
|
-
"@type": "Product",
|
|
41
|
-
"name": "${product.title}",
|
|
42
|
-
"image": [
|
|
43
|
-
${image ? `"${image.originalSrc}"` : ''}
|
|
44
|
-
],
|
|
45
|
-
"description": "${description}",
|
|
46
|
-
"brand": {
|
|
47
|
-
"@type": "Brand",
|
|
48
|
-
"name": "${product.vendor}"
|
|
49
|
-
},
|
|
50
|
-
"offers": {
|
|
51
|
-
"@type": "Offer",
|
|
52
|
-
"url": "${url}",
|
|
53
|
-
"priceCurrency": "${price.currencyCode}",
|
|
54
|
-
"price": "${price.amount}",
|
|
55
|
-
"availability": "https://schema.org/${
|
|
56
|
-
variant.availableForSale ? 'InStock' : 'OutOfStock'
|
|
57
|
-
}"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
`}</script>
|
|
61
|
-
</Helmet>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Return a global SEO helper if no other props were passed.
|
|
67
|
-
* Useful for placing in the "main" <App> container.
|
|
68
|
-
*/
|
|
69
|
-
return (
|
|
70
|
-
<Helmet defaultTitle={shopName} titleTemplate={`%s - ${shopName}`}>
|
|
71
|
-
<html lang={lang} />
|
|
72
|
-
<meta property="og:site_name" content={shopName} />
|
|
73
|
-
</Helmet>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import renderHydrogen from '@shopify/hydrogen/entry-client';
|
|
2
|
-
import {ShopifyProvider} from '@shopify/hydrogen/client';
|
|
3
|
-
|
|
4
|
-
import shopifyConfig from '../shopify.config';
|
|
5
|
-
|
|
6
|
-
function ClientApp({children}) {
|
|
7
|
-
return (
|
|
8
|
-
<ShopifyProvider shopifyConfig={shopifyConfig}>{children}</ShopifyProvider>
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default renderHydrogen(ClientApp);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<svg width="410" height="404" viewBox="0 0 410 404" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M399.641 59.5246L215.643 388.545C211.844 395.338 202.084 395.378 198.228 388.618L10.5817 59.5563C6.38087 52.1896 12.6802 43.2665 21.0281 44.7586L205.223 77.6824C206.398 77.8924 207.601 77.8904 208.776 77.6763L389.119 44.8058C397.439 43.2894 403.768 52.1434 399.641 59.5246Z" fill="url(#paint0_linear)"/>
|
|
3
|
-
<path d="M292.965 1.5744L156.801 28.2552C154.563 28.6937 152.906 30.5903 152.771 32.8664L144.395 174.33C144.198 177.662 147.258 180.248 150.51 179.498L188.42 170.749C191.967 169.931 195.172 173.055 194.443 176.622L183.18 231.775C182.422 235.487 185.907 238.661 189.532 237.56L212.947 230.446C216.577 229.344 220.065 232.527 219.297 236.242L201.398 322.875C200.278 328.294 207.486 331.249 210.492 326.603L212.5 323.5L323.454 102.072C325.312 98.3645 322.108 94.137 318.036 94.9228L279.014 102.454C275.347 103.161 272.227 99.746 273.262 96.1583L298.731 7.86689C299.767 4.27314 296.636 0.855181 292.965 1.5744Z" fill="url(#paint1_linear)"/>
|
|
4
|
-
<defs>
|
|
5
|
-
<linearGradient id="paint0_linear" x1="6.00017" y1="32.9999" x2="235" y2="344" gradientUnits="userSpaceOnUse">
|
|
6
|
-
<stop stop-color="#41D1FF"/>
|
|
7
|
-
<stop offset="1" stop-color="#BD34FE"/>
|
|
8
|
-
</linearGradient>
|
|
9
|
-
<linearGradient id="paint1_linear" x1="194.651" y1="8.81818" x2="236.076" y2="292.989" gradientUnits="userSpaceOnUse">
|
|
10
|
-
<stop stop-color="#FFEA83"/>
|
|
11
|
-
<stop offset="0.0833333" stop-color="#FFDD35"/>
|
|
12
|
-
<stop offset="1" stop-color="#FFA800"/>
|
|
13
|
-
</linearGradient>
|
|
14
|
-
</defs>
|
|
15
|
-
</svg>
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useShopQuery,
|
|
3
|
-
flattenConnection,
|
|
4
|
-
ProductProviderFragment,
|
|
5
|
-
} from '@shopify/hydrogen';
|
|
6
|
-
import gql from 'graphql-tag';
|
|
7
|
-
|
|
8
|
-
import HighlightedProduct from '../components/HightlightedProduct.client';
|
|
9
|
-
import Layout from '../components/Layout.client';
|
|
10
|
-
import ProductCard from '../components/ProductCard.client';
|
|
11
|
-
|
|
12
|
-
export default function Index() {
|
|
13
|
-
const {data} = useShopQuery({
|
|
14
|
-
query: QUERY,
|
|
15
|
-
variables: {
|
|
16
|
-
numProducts: 3,
|
|
17
|
-
numProductMetafields: 0,
|
|
18
|
-
numProductVariants: 250,
|
|
19
|
-
numProductMedia: 1,
|
|
20
|
-
numProductVariantMetafields: 10,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const products = data ? flattenConnection(data.products) : [];
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<Layout>
|
|
28
|
-
<div className="z-0 gradient w-screen h-screen top-0 left-0 right-0 fixed" />
|
|
29
|
-
<div className="z-5 relative space-y-16">
|
|
30
|
-
<section className="md:px-4 pt-10 pb-4">
|
|
31
|
-
<HydrogenGettingStarted />
|
|
32
|
-
</section>
|
|
33
|
-
|
|
34
|
-
<section className="space-y-6 md:space-y-0 md:grid grid-cols-3 gap-10">
|
|
35
|
-
<div>
|
|
36
|
-
<CommerceReadyComponents />
|
|
37
|
-
</div>
|
|
38
|
-
<div className="col-span-2 md:flex shadow-xl p-4 md:p-6 rounded-md bg-white">
|
|
39
|
-
<HighlightedProduct product={products[0]} />
|
|
40
|
-
</div>
|
|
41
|
-
</section>
|
|
42
|
-
|
|
43
|
-
<section className="space-y-6 md:space-y-0 md:grid grid-cols-3 gap-10 flex flex-col-reverse flex-col">
|
|
44
|
-
<div className="col-span-2 md:flex shadow-xl p-4 md:p-6 rounded-md space-y-6 md:space-y-0 md:space-x-6 bg-white">
|
|
45
|
-
{[products[1], products[2]].map((product) => {
|
|
46
|
-
return (
|
|
47
|
-
<div key={product.id}>
|
|
48
|
-
<ProductCard product={product} />
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
})}
|
|
52
|
-
</div>
|
|
53
|
-
<div>
|
|
54
|
-
<StyleWithTailwind />
|
|
55
|
-
</div>
|
|
56
|
-
</section>
|
|
57
|
-
</div>
|
|
58
|
-
</Layout>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function HydrogenGettingStarted() {
|
|
63
|
-
const links = [
|
|
64
|
-
{
|
|
65
|
-
text: 'Browse Hydrogen documentation',
|
|
66
|
-
url: 'https://shopify.dev/beta/hydrogen/',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
text: 'Open the GraphiQL editor',
|
|
70
|
-
url: '/graphiql',
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
text: 'Explore starter templates',
|
|
74
|
-
url: '/',
|
|
75
|
-
},
|
|
76
|
-
];
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<>
|
|
80
|
-
<h2 className="text-4xl md:text-7xl font-extrabold text-center">
|
|
81
|
-
Hello, Hydrogen
|
|
82
|
-
</h2>
|
|
83
|
-
|
|
84
|
-
<p className="text-xl text-center mt-4 mb-8">
|
|
85
|
-
Welcome to your custom storefront. Let‘s get building.
|
|
86
|
-
</p>
|
|
87
|
-
|
|
88
|
-
<ul className="md:flex justify-center gap-5 space-y-4 md:space-y-0">
|
|
89
|
-
{links.map((link) => (
|
|
90
|
-
<li key={link.url}>
|
|
91
|
-
<a
|
|
92
|
-
href={link.url}
|
|
93
|
-
className="rounded-full bg-white px-4 py-2 bg-opacity-80 flex items-center gap-2"
|
|
94
|
-
>
|
|
95
|
-
{link.text}
|
|
96
|
-
<svg
|
|
97
|
-
width="7"
|
|
98
|
-
height="13"
|
|
99
|
-
viewBox="0 0 7 13"
|
|
100
|
-
fill="none"
|
|
101
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
102
|
-
>
|
|
103
|
-
<path
|
|
104
|
-
d="M1 1.5L6 6.5L1 11.5"
|
|
105
|
-
stroke="currentColor"
|
|
106
|
-
strokeWidth="2"
|
|
107
|
-
strokeLinecap="round"
|
|
108
|
-
strokeLinejoin="round"
|
|
109
|
-
/>
|
|
110
|
-
</svg>
|
|
111
|
-
</a>
|
|
112
|
-
</li>
|
|
113
|
-
))}
|
|
114
|
-
</ul>
|
|
115
|
-
</>
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function CommerceReadyComponents() {
|
|
120
|
-
return (
|
|
121
|
-
<>
|
|
122
|
-
<h2 className="font-bold text-3xl">Commerce-ready components</h2>
|
|
123
|
-
<p className="text-xl leading-8 mt-2 mb-4">
|
|
124
|
-
Hydrogen includes the most common components for commerce, powered by
|
|
125
|
-
your Shopify custom storefront. They're accessible, performant, and
|
|
126
|
-
ready for implementation.
|
|
127
|
-
</p>
|
|
128
|
-
<a
|
|
129
|
-
className="text-blue-500 text-xl flex items-center gap-1"
|
|
130
|
-
href="https://shopify.dev/beta/hydrogen/"
|
|
131
|
-
>
|
|
132
|
-
Browse components
|
|
133
|
-
<svg
|
|
134
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
135
|
-
className="h-5 w-5"
|
|
136
|
-
viewBox="0 0 20 20"
|
|
137
|
-
fill="currentColor"
|
|
138
|
-
>
|
|
139
|
-
<path
|
|
140
|
-
fillRule="evenodd"
|
|
141
|
-
d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z"
|
|
142
|
-
clipRule="evenodd"
|
|
143
|
-
/>
|
|
144
|
-
</svg>
|
|
145
|
-
</a>
|
|
146
|
-
</>
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function StyleWithTailwind() {
|
|
151
|
-
return (
|
|
152
|
-
<>
|
|
153
|
-
<h2 className="font-bold text-3xl">
|
|
154
|
-
Style with Tailwind or roll your own
|
|
155
|
-
</h2>
|
|
156
|
-
<p className="text-xl leading-8 mt-2 mb-4">
|
|
157
|
-
Hydrogen starter templates are styled using the flexible{' '}
|
|
158
|
-
<a className="text-blue-500" href="https://www.tailwindcss.com">
|
|
159
|
-
Tailwind CSS
|
|
160
|
-
</a>{' '}
|
|
161
|
-
framework. Start building with Tailwind's library or choose your
|
|
162
|
-
own styling - it's up to you.
|
|
163
|
-
</p>
|
|
164
|
-
</>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const QUERY = gql`
|
|
169
|
-
query indexContent(
|
|
170
|
-
$numProducts: Int!
|
|
171
|
-
$numProductMetafields: Int!
|
|
172
|
-
$numProductVariants: Int!
|
|
173
|
-
$numProductMedia: Int!
|
|
174
|
-
$numProductVariantMetafields: Int!
|
|
175
|
-
) {
|
|
176
|
-
products(first: $numProducts) {
|
|
177
|
-
edges {
|
|
178
|
-
node {
|
|
179
|
-
...ProductProviderFragment
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
${ProductProviderFragment}
|
|
186
|
-
`;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {RawHtml, useShopQuery} from '@shopify/hydrogen';
|
|
2
|
-
import {useParams} from 'react-router-dom';
|
|
3
|
-
import gql from 'graphql-tag';
|
|
4
|
-
|
|
5
|
-
import Layout from '../../../components/Layout.client';
|
|
6
|
-
|
|
7
|
-
export default function Article() {
|
|
8
|
-
const {handle, articleHandle} = useParams();
|
|
9
|
-
const {data} = useShopQuery({
|
|
10
|
-
query: QUERY,
|
|
11
|
-
variables: {handle, articleHandle},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const article = data.blogByHandle.articleByHandle;
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<Layout>
|
|
18
|
-
<section className="my-8 px-4 pt-10 pb-4 text-white">
|
|
19
|
-
<h1 className="text-7xl mb-4 font-semibold tracking-tight">
|
|
20
|
-
{article.title}
|
|
21
|
-
</h1>
|
|
22
|
-
</section>
|
|
23
|
-
|
|
24
|
-
<section className="my-8 bg-white rounded-3xl p-10 sticky shadow-2xl">
|
|
25
|
-
<p className="font-medium mt-1">
|
|
26
|
-
Published {new Date(article.publishedAt).toLocaleDateString()} by{' '}
|
|
27
|
-
{article.author.name}
|
|
28
|
-
</p>
|
|
29
|
-
|
|
30
|
-
<RawHtml string={article.contentHtml} className="prose mt-8" />
|
|
31
|
-
</section>
|
|
32
|
-
</Layout>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const QUERY = gql`
|
|
37
|
-
query ArticleDetails($handle: String!, $articleHandle: String!) {
|
|
38
|
-
blogByHandle(handle: $handle) {
|
|
39
|
-
articleByHandle(handle: $articleHandle) {
|
|
40
|
-
title
|
|
41
|
-
contentHtml
|
|
42
|
-
publishedAt
|
|
43
|
-
author: authorV2 {
|
|
44
|
-
name
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
`;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {useParams} from 'react-router-dom';
|
|
2
|
-
import {useShopQuery, RawHtml, Link} from '@shopify/hydrogen';
|
|
3
|
-
import gql from 'graphql-tag';
|
|
4
|
-
|
|
5
|
-
import Layout from '../../components/Layout.client';
|
|
6
|
-
|
|
7
|
-
export default function Blog() {
|
|
8
|
-
const {handle} = useParams();
|
|
9
|
-
const {data} = useShopQuery({query: QUERY, variables: {handle}});
|
|
10
|
-
|
|
11
|
-
const blog = data.blogByHandle;
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Layout>
|
|
15
|
-
<div className="relative">
|
|
16
|
-
<section className="my-8 px-4 pt-10 pb-4 text-white">
|
|
17
|
-
<h1 className="text-7xl mb-4 font-semibold tracking-tight">
|
|
18
|
-
{blog.title}
|
|
19
|
-
</h1>
|
|
20
|
-
</section>
|
|
21
|
-
|
|
22
|
-
<section className="my-8 px-4 pb-4">
|
|
23
|
-
<ul className="space-y-12 mt-8">
|
|
24
|
-
{blog.articles.edges.map((edge) => {
|
|
25
|
-
const article = edge.node;
|
|
26
|
-
return (
|
|
27
|
-
<li
|
|
28
|
-
key={article.id}
|
|
29
|
-
className="p-5 rounded-3xl overflow-hidden shadow-2xl bg-white bg-opacity-70"
|
|
30
|
-
>
|
|
31
|
-
<h2 className="text-xl font-medium">
|
|
32
|
-
<Link to={`/blogs/${handle}/${article.handle}`}>
|
|
33
|
-
{article.title}
|
|
34
|
-
</Link>
|
|
35
|
-
</h2>
|
|
36
|
-
<p className="font-medium mt-1">
|
|
37
|
-
Published on{' '}
|
|
38
|
-
{new Date(article.publishedAt).toLocaleDateString()} by{' '}
|
|
39
|
-
{article.author.name}
|
|
40
|
-
</p>
|
|
41
|
-
|
|
42
|
-
<RawHtml
|
|
43
|
-
string={article.contentHtml}
|
|
44
|
-
className="mt-2 prose"
|
|
45
|
-
/>
|
|
46
|
-
</li>
|
|
47
|
-
);
|
|
48
|
-
})}
|
|
49
|
-
</ul>
|
|
50
|
-
</section>
|
|
51
|
-
</div>
|
|
52
|
-
</Layout>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const QUERY = gql`
|
|
57
|
-
query BlogDetails($handle: String!) {
|
|
58
|
-
blogByHandle(handle: $handle) {
|
|
59
|
-
title
|
|
60
|
-
articles(first: 10) {
|
|
61
|
-
edges {
|
|
62
|
-
node {
|
|
63
|
-
id
|
|
64
|
-
title
|
|
65
|
-
handle
|
|
66
|
-
publishedAt
|
|
67
|
-
contentHtml
|
|
68
|
-
author {
|
|
69
|
-
name
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
`;
|