Boutique store: Ouro Pro
Ouro sells handmade home goods. Product pictures are drawn in the swatch you pick, so the demo needs no photos; swap in your images through ProductCard's renderImage. Try the promo code SLOW10 in the bag.
Use the whole app
import { StoreApp } from '@patine-ui/pro';
<StoreApp />;
| Prop | Type | Default |
|---|---|---|
initialRoute | 'discover' | 'shop' | 'product' | 'bag' | 'checkout' | 'order' | 'saved' | 'account' | 'discover' |
demo | 'ready' | 'loading' | 'empty' | 'error' | 'ready' |
insets | { top, bottom } | None |
platform | 'ios' | 'android' | 'web' | Platform.OS |
Screens move the platform's way: on iOS a pushed screen slides in from the trailing edge, on Android they fade through, on the web and between tabs they fade in. Reduce motion turns it off.
Screens
| Screen | What it does |
|---|---|
DiscoverScreen | Collections in an autoplaying Carousel, categories, new arrivals and bestsellers on Pro's ProductCard |
ShopScreen | SearchField, category chips, a sort Select and a grid that grows to four columns |
ProductScreen | A Pager gallery with dots, swatches, a quantity stepper, Add to bag that becomes View bag, an Accordion of details, ReviewList, pairings |
BagScreen | Free-delivery progress, SwipeableRow to save or remove, a promo code, totals, Checkout pinned |
StoreCheckoutScreen | Pro's Wizard: address with validation, delivery RadioGroup, payment with brand logos, review |
OrderScreen | Pro's OrderTracker with courier scans, the items, help |
SavedScreen | The wishlist with Add to bag on the card and an empty state |
StoreAccountScreen | A members card with points, orders with status badges, settings |
Every screen is exported on its own, takes its data as props, and has sample data as defaults. bagTotals(lines, products, discount, delivery) works out items, promo, delivery (free past €75) and how far from free delivery; filterProducts searches, filters and sorts.
Built with
The free components, from patine-ui:
Accordion · Avatar · Badge · Button · Carousel, PageIndicator, Pager · ChipGroup · DescriptionList · Heading, Text · List, ListItem · Progress · RadioGroup, RadioGroupItem · Rating · SearchField · Select · Separator · SwipeableRow · TextField
And from Patine Pro:
- App shell and layout PRO
- Brand logos PRO
- Order tracker PRO
- Product card PRO
- Review list PRO
- Wizard PRO
Files
store/
├── components/
│ └── StoreProductCard.tsx
├── hooks/
│ ├── useStoreApp.ts
│ └── useStoreScreens.ts
├── BagScreen.tsx
├── BrowseScreen.tsx
├── DiscoverScreen.tsx
├── index.ts
├── OrderScreen.tsx
├── ProductScreen.tsx
├── SavedScreen.tsx
├── store.constants.ts
├── store.types.ts
├── store.utils.ts
├── StoreAccountScreen.tsx
├── StoreApp.tsx
└── StoreCheckoutScreen.tsx
It also uses shared/, the theme, money formatting and screen transitions every Pro app shares.
A look at the code
The bag’s totals, promo and free-delivery threshold, from store.utils.ts:
/**
* What the bag comes to: the items, a promo off them, delivery (free past the threshold for standard), and how far from free
* shipping it still is.
*/
export const bagTotals = (lines: readonly BagLine[], products: readonly Product[], discount = 0, delivery: number = SHIPPING_FEE) => {
const subtotal = lines.reduce((sum, l) => sum + (productById(products, l.productId)?.price ?? 0) * l.quantity, 0);
const off = Math.round(subtotal * discount);
const shipping = subtotal === 0 || (delivery === SHIPPING_FEE && subtotal - off >= FREE_SHIPPING) ? 0 : delivery;
return {
count: lines.reduce((n, l) => n + l.quantity, 0),
subtotal,
discount: off,
shipping,
total: subtotal - off + shipping,
toFreeShipping: Math.max(0, FREE_SHIPPING - (subtotal - off)),
};
};