Seconds savings table — Storefront block

Pro

storefront-seconds-savings-table · for home, catalog, landing pages

Seconds savings table

A table of each second against its price new, with the saving: a shop that sells many seconds and wants them compared

Documentation

Installation

One command copies the block into your project with the shadcn CLI (the registry is set once: Installation).

pnpm dlx shadcn-vue@latest add @trame/storefront-seconds-savings-table

Usage

Its demo data, shortened (Using blocks).

<script setup lang="ts">
import StorefrontSecondsSavingsTable from '@/components/trame/blocks/storefront/storefront-seconds-savings-table.vue'

const props = {
title: "Seconds",
lead: "A stitching flaw, a damaged box, a return tried on once: every piece is inspected, its flaw is written down, and its price drops to match.",
grades: [
{
grade: "A",
text: "A finishing detail or damaged packaging: the product is as good as new."
},
{
grade: "B",
text: "A cosmetic flaw visible up close, with no effect on use or durability."
}
],
items: [
{
id: 1,
name: "Open Air jacket",
price: 12900,
compareAt: 18900,
image: "https://images.unsplash.com/photo-1591047139829-d91aecb6caea?w=1600&q=80",
alt: "An orange windbreaker on a hanger",
grade: "A",
defect: "Pocket zipper came unstitched and was sewn back by hand. No effect on use.",
note: "One-year warranty"
},
{
id: 2,
name: "City backpack 22 L",
price: 4900,
compareAt: 7900,
image: "https://images.unsplash.com/photo-1680039211156-66c721b87625?w=1600&q=80",
alt: "A black flap backpack against a yellow background",
grade: "B",
defect: "Slight stain on the left strap that barely comes out in the wash.",
note: "One-year warranty"
}
],
open: "product",
more: {
label: "See all seconds",
action: "collection",
record: {
id: "secondes"
}
},
options: {
eyebrow: "Seconds"
}
}
</script>

<template>
<StorefrontSecondsSavingsTable v-bind="props" />
</template>

Props

Each prop says who changes it: Words, Picture, Action, Design, Data.* required.

PropTypeDescription
title*stringWordswhat the page shows ("Seconds")
leadstringWordswhy these items are second choices, in the merchant’s own words
gradesGrade[]the merchant’s grade scale
items*Item[]Datathe second-choice products, each with its grade and its defect
openstringActionthe page action a product opens; it receives the product
moreMorethe see-more link: its words and the page action it runs
optionsOptionsthe block’s settings: layout choices and secondary words, read by every variant
Grade grades[] · 2 props
PropTypeDescription
grade*stringWordsa grade, spelled as in the products
text*stringWordswhat it means ("No visible defect, damaged packaging")
Item items[] · 11 props
PropTypeDescription
id*string | numberDatathe record’s id in the tool that answers it
name*stringWordsthe product’s name
price*numberan amount in cents
compareAtnumberthe price before the merchant’s reduction
imagestring | nullPicturethe main picture; null or absent: the product has none yet
altstringWordswhat the main picture shows
categorystringWordsthe product’s category, e.g. "Knitwear"
availablebooleanfalse: sold out; true or absent: can be bought
grade*stringWordsthe grade the merchant gives it ("A", "B", "Refurbished")
defect*stringWordsthe honest reason it is a second ("Small ink stain on the lining, no effect on use")
notestringWordsa precision on its condition or its warranty ("One-year guarantee")
More more · 3 props
PropTypeDescription
label*stringWordswhat happens ("See all second-hand items")
action*stringActiona named action of the page
recordRecord<string, unknown>Datathe record the action opens, if any
Options options · 2 props
PropTypeDescription
eyebrowstringWordsa small line above the title
mood'inverse' | 'brand' | 'warm' | 'tint' | stringa band of the page that redefines the theme surfaces inside it
What it asks your app for

The block never knows your app: it asks it, through one context provided once, where its links lead, what its actions do, how a price reads and which words to say (The host context).

MemberWhat it is for
hrefthe address an action leads to, or null to hide what leads there
actruns a change (subscribe, add to cart, save) and answers { ok } or { ok: false, error }
canwhether the page has this action
moneyformats a price, given in cents
asseta picture’s address as your app serves it
Linkyour router’s link component
cartCountthe cart badge’s number
cartDrawerwhether your app has a cart drawer
cartOpenwhether the cart drawer is open
labelyour word for an interface key, or undefined to keep the block’s own

The words it says itself, in English and French; label(key) replaces any of them:

KeyEnglishFrench
newsletter.alreadyYou are already subscribed.Vous êtes déjà inscrit.
newsletter.doneDone: you are subscribed.C’est noté : vous êtes inscrit.
newsletter.invalidCheck the email address.Vérifiez l’adresse e-mail.
newsletter.tooManyToo many attempts, try again in a moment.Trop de tentatives, réessayez dans un moment.

Features

  • Every word in the server HTML
  • Same markup in Vue and React
  • Theme tokens only: every theme, light and dark
  • Shows what you give it, invents nothing
  • Subtle motion: one short reveal; still under reduced motion
  • Real buttons and links, a visible focus
  • Asks your app through actions: open, more
  • Reads products from your app

A storefront section, for home, catalog, landing pages; it uses @lucide/vue, class-variance-authority, clsx, motion, reka-ui, tailwind-merge.

Built with

The components this block is made of; each one installs on its own too.

More storefront blocks

  • Search panel top sheet: a wide band under the header, the field across the width, popular searches as a column of words beside product tiles: a large catalogue.
  • Search panel: the same content in a compact panel under the header: a search that opens from the header.
  • Search results grouped: every group on the page at once, products large and the categories and articles in a side column: for shops with a rich journal or many categories.
  • Search results tabs: one group at a time (products, categories, articles) behind a tab row with real counts: for shops where products are what people want and the rest is a side road.
  • Service glossary: the terms a service uses, each with its meaning and price: a repair glossary, a duty glossary.
  • Shared list with comments: a list kept by several people, with who added what and the comments: a household, a gift list.
  • Shared list with progress: a gift list shared with guests (wedding, birth, moving in): what is wanted, how many are already given, and "Give" on each, with the list’s progress beside.
  • Shoot notes margin notes: a few big frames each with a short note written like a margin comment, and the budget line: the making-of of a collection.

All 409 storefront blocks