JA
ベータ版の翻訳

@core / kit-store

1.0.1 ▾
認証済みMIT
GitHub

Next.js 向けオンラインストアキット:カタログ、カート、Stripe 決済、注文、配送、クーポン、レビュー、アカウント

コード27 ファイルコンテキスト約 1024 トークンスキャン合格

.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 でログインしてください。

GitHub で続ける