summaryrefslogtreecommitdiff
path: root/examples/with-nanostores/src/pages/index.astro
blob: 07458e0be29a0b0cb677187688ef207af4088b2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
import type { CartItemDisplayInfo } from '../cartStore';
import Layout from '../layouts/Layout.astro';
import AddToCartForm from '../components/AddToCartForm';
import FigurineDescription from '../components/FigurineDescription.astro';

const item: CartItemDisplayInfo = {
	id: 'astronaut-figurine',
	name: 'Astronaut Figurine',
	imageSrc: '/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>