aboutsummaryrefslogtreecommitdiff
path: root/examples/with-nanostores/src/pages/index.astro
diff options
context:
space:
mode:
authorGravatar github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> 2025-06-05 14:25:23 +0000
committerGravatar github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> 2025-06-05 14:25:23 +0000
commite586d7d704d475afe3373a1de6ae20d504f79d6d (patch)
tree7e3fa24807cebd48a86bd40f866d792181191ee9 /examples/with-nanostores/src/pages/index.astro
downloadastro-e586d7d704d475afe3373a1de6ae20d504f79d6d.tar.gz
astro-e586d7d704d475afe3373a1de6ae20d504f79d6d.tar.zst
astro-e586d7d704d475afe3373a1de6ae20d504f79d6d.zip
Sync from a8e1c0a7402940e0fc5beef669522b315052df1blatest
Diffstat (limited to 'examples/with-nanostores/src/pages/index.astro')
-rw-r--r--examples/with-nanostores/src/pages/index.astro50
1 files changed, 50 insertions, 0 deletions
diff --git a/examples/with-nanostores/src/pages/index.astro b/examples/with-nanostores/src/pages/index.astro
new file mode 100644
index 000000000..c90609595
--- /dev/null
+++ b/examples/with-nanostores/src/pages/index.astro
@@ -0,0 +1,50 @@
+---
+import type { CartItemDisplayInfo } from '../cartStore';
+import Layout from '../layouts/Layout.astro';
+import AddToCartForm from '../components/AddToCartForm';
+import FigurineDescription from '../components/FigurineDescription.astro';
+import { withBase } from '../utils';
+
+const item: CartItemDisplayInfo = {
+ id: 'astronaut-figurine',
+ name: 'Astronaut Figurine',
+ imageSrc: withBase('/images/astronaut-figurine.png'),
+};
+---
+
+<Layout title={item.name}>
+ <main>
+ <div class="product-layout">
+ <div>
+ <FigurineDescription />
+ <AddToCartForm item={item} client:load>
+ <button type="submit">Add to cart</button>
+ </AddToCartForm>
+ </div>
+ <img src={item.imageSrc} alt={item.name} />
+ </div>
+ </main>
+</Layout>
+
+<style>
+ main {
+ margin: auto;
+ padding: 1em;
+ max-width: var(--content-max-width);
+ }
+
+ .product-layout {
+ display: grid;
+ gap: 2rem;
+ grid-template-columns: repeat(auto-fit, minmax(20rem, max-content));
+ }
+
+ .product-layout img {
+ width: 100%;
+ max-width: 26rem;
+ }
+
+ button[type='submit'] {
+ margin-block-start: 1rem;
+ }
+</style>