diff --git a/.changeset/floppy-bears-kneel.md b/.changeset/floppy-bears-kneel.md
new file mode 100644
index 0000000..3ebc157
--- /dev/null
+++ b/.changeset/floppy-bears-kneel.md
@@ -0,0 +1,5 @@
+---
+'snappycart': major
+---
+
+Getting ready for release by prepping the demo for users (developers).
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index aeee8c7..4572b2d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,10 +1,10 @@
name: CI
on:
- push:
- branches: [master]
pull_request:
- branches: [master]
+ push:
+ branches:
+ - $default-branch
jobs:
build-and-test:
@@ -12,18 +12,28 @@ jobs:
steps:
- name: Checkout code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
- name: Setup Node.js
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version: '18'
+ cache: npm
- name: Install dependencies
- run: npm install
+ run: npm ci
+
+ - name: Changesets status
+ env:
+ BASE_REF: ${{ github.base_ref || github.event.repository.default_branch }}
+ run: |
+ git fetch origin "$BASE_REF"
+ npx changeset status --since="origin/$BASE_REF"
- name: Run tests
- run: npm run test
+ run: npm test
- name: Run linter
run: npm run lint
diff --git a/src/App.tsx b/src/App.tsx
index 5a462e8..1a58978 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,9 +1,17 @@
import { useMemo, useState } from 'react';
-import CartDrawer from './cart/components/CartDrawer';
-import CartIcon from './cart/components/CartIcon/CartIcon';
import { useCart } from './cart/hooks/useCart';
import type { CartProduct } from './cart/types/types';
+import CartDrawer from './cart/components/CartDrawer';
+import CartIcon from './cart/components/CartIcon/CartIcon';
+
+import styles from './demo/DemoHome.module.scss';
+import { SiteHeader } from './demo/components/SiteHeader/SiteHeader';
+import { ProductGrid } from './demo/components/ProductGrid/ProductGrid';
+import { Quickstart } from './demo/components/Quickstart/Quickstart';
+import { UseCases } from './demo/components/UseCases/UseCases';
+import { SiteFooter } from './demo/components/SiteFooter/SiteFooter';
+
export default function App() {
const { addItem } = useCart();
const [open, setOpen] = useState(false);
@@ -12,25 +20,148 @@ export default function App() {
() => [
{ id: 'apple', name: 'Apple', price: 0.6, imageUrl: 'apple.png' },
{ id: 'banana', name: 'Banana', price: 0.4, imageUrl: 'banana.png' },
+ { id: 'orange', name: 'Orange', price: 0.55, imageUrl: 'orange.png' },
+ { id: 'strawberry', name: 'Strawberries', price: 1.25, imageUrl: 'strawberry.png' },
],
[],
);
+ const handleAddStarterSet = () => {
+ addItem(products[0]);
+ addItem(products[1], 2);
+ addItem(products[2]);
+ };
+
return (
- <>
-
Demo eCommerce
-
-
-
-
-
+
+
setOpen(true)}
+ links={[
+ { label: 'Quickstart', href: '#quickstart' },
+ { label: 'Use cases', href: '#use-cases' },
+ { label: 'Demo shop', href: '#demo-shop' },
+ { label: 'GitHub', href: 'https://github.com/idncod/snappycart', external: true },
+ { label: 'npm', href: 'https://www.npmjs.com/package/snappycart', external: true },
+ ]}
+ />
+
+
+
+
+
+
Integration starter
+
snappycart
+
+ Add items, open the drawer, ship. Use the snippets below to integrate into React or
+ Next.js in minutes.
+
+
+
+
+
+
+
+
+ React
+ TypeScript
+ SCSS
+ Headless-friendly
+
+
+
+
+
+
Step 1: Trigger cart actions
+
+
+
+
+
+
+
+
+ Tip: add items, then open the drawer. Everything here should mirror how users
+ integrate it.
+
+
+
+
+
+
What you get
+
+
+
+ CartProvider
+
+
+ useCart()
+
+
+ CartIcon + CartDrawer
+
+
+ Types exported
+
+
+
+
+
+
+
+
+
+
+
Quickstart
+
Copy paste, no ceremony.
+
+
+
+
+
+
+
Use cases
+
Buttons trigger real cart behavior.
+
+ setOpen(true)} />
+
+
+
+
+
Demo shop
+
This is the “integration UI” people expect.
+
+ addItem(p, qty)} />
+
+
+
+
setOpen(true)} />
setOpen(false)} />
- >
+
);
}
diff --git a/src/cart/components/CartIcon/CartIcon.tsx b/src/cart/components/CartIcon/CartIcon.tsx
index 022f615..f3a6ccc 100644
--- a/src/cart/components/CartIcon/CartIcon.tsx
+++ b/src/cart/components/CartIcon/CartIcon.tsx
@@ -16,7 +16,12 @@ export default function CartIcon({ position = 'bottom-right', onClick }: CartIco
: 'sc-bottom-right';
return (
-