JA
ベータ版の翻訳

@core / blocks

1.0.0 ▾
認証済みMIT
GitHub

ページブロック:アクセシブルな 15 セクション(ヒーロー、料金、JSON-LD 付き FAQ など)、管理エディタ、拡張可能な登録

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

.genpmignore 適用後に組み込まれる正確なツリーです。固定先:

src/lib/blocks/core/guarantee.ts読み取り専用 · a255d6d
import { createElement as h } from 'react';
import { z } from 'zod';
import { defineBlock } from '../define.ts';
import { href, optText, Section, text } from '../parts.ts';

export const guarantee = defineBlock({
  type: 'guarantee',
  label: 'Guarantee',
  icon: 'shield',
  schema: z.object({ badge: optText(30), title: text(160), text: text(1000), termsHref: href, termsLabel: optText(60) }),
  fields: [
    { name: 'badge', label: 'Badge (e.g. "30 days")', type: 'text' },
    { name: 'title', label: 'Title', type: 'text', required: true },
    { name: 'text', label: 'Text', type: 'textarea', required: true, help: 'Never present the legal 2-year guarantee or 14-day withdrawal right as an extra.' },
    { name: 'termsHref', label: 'Terms link', type: 'url' },
    { name: 'termsLabel', label: 'Terms link text', type: 'text' },
  ],
  defaults: () => ({ title: 'Money-back guarantee', text: '…' }),
  Component: ({ data, ctx }) =>
    h(
      Section,
      { id: ctx.id, block: 'guarantee', title: data.title, ctx },
      data.badge && h('p', { className: 'blk-guarantee__badge' }, data.badge),
      h('p', null, data.text),
      data.termsHref && h('p', null, h('a', { href: data.termsHref }, data.termsLabel ?? 'Terms')),
    ),
});

@core/blocks を報告

パッケージを報告するには GitHub でログインしてください。

GitHub で続ける