ZH
测试版翻译

@core / kit-store

1.0.1 ▾
已验证MIT
GitHub

Next.js 网店套件:商品目录、购物车、Stripe 结账、订单、配送、优惠券、真实评价和账户

代码27 个文件上下文约 1024 个 token扫描通过

应用 .genpmignore 后将被注入的确切目录树。固定于

src/app/(store)/_components/product-card.tsx只读 · 6a45dae
import type { ProductSummary } from '@/lib/catalog';
import { imageFor } from '@/lib/media';
import { price, productPath } from '../_lib/store';

export async function ProductCard({ product, level = 2 }: { product: ProductSummary; level?: number }) {
  const H = `h${Math.min(Math.max(level, 2), 6)}` as 'h2';
  const img = await imageFor(product.image, { sizes: '(min-width: 1024px) 25vw, 50vw', alt: '' });
  const from = product.priceMax.amount > product.price.amount;
  return (
    <article className="blk-card store-card">
      {img && <img {...img} alt={img.alt} loading="lazy" decoding="async" className="store-card__image" />}
      <H className="store-card__title">
        <a href={productPath(product)}>{product.name}</a>
      </H>
      <p className="store-price">
        {from && 'From '}
        {price(product.price)}
      </p>
      {!product.available && <p className="ui-badge ui-badge--warning">Out of stock</p>}
    </article>
  );
}

举报 @core/kit-store

使用 GitHub 登录后才能举报包。