KO
베타 번역

@core / blocks

1.0.0 ▾
인증됨MIT
GitHub

페이지 블록: 접근성 갖춘 15개 섹션(히어로, 가격, JSON-LD FAQ 등), 관리자 편집기, 확장 가능한 등록

코드파일 25개컨텍스트약 681토큰검사 통과

.genpmignore 적용 후 주입될 정확한 트리입니다. 고정 대상:

src/lib/blocks/core/stats.ts읽기 전용 · a255d6d
import { createElement as h } from 'react';
import { z } from 'zod';
import { defineBlock } from '../define.ts';
import { optText, Section, text } from '../parts.ts';

export const stats = defineBlock({
  type: 'stats',
  label: 'Stats',
  icon: 'chart',
  schema: z.object({ title: optText(160), items: z.array(z.object({ value: text(20), label: text(100) })).min(1).max(6), source: optText(200) }),
  fields: [
    { name: 'title', label: 'Title', type: 'text' },
    {
      name: 'items',
      label: 'Numbers',
      type: 'list',
      required: true,
      fields: [
        { name: 'value', label: 'Value', type: 'text', required: true },
        { name: 'label', label: 'Label', type: 'text', required: true },
      ],
    },
    { name: 'source', label: 'Source (claims must be verifiable)', type: 'text' },
  ],
  defaults: () => ({ items: [{ value: '100+', label: 'Customers' }] }),
  Component: ({ data, ctx }) =>
    h(
      Section,
      { id: ctx.id, block: 'stats', title: data.title, ctx, label: 'Stats' },
      h('dl', { className: 'blk-stats' }, data.items.map((it, i) => h('div', { key: i }, h('dt', null, it.label), h('dd', null, it.value)))),
      data.source && h('p', { className: 'blk__note' }, data.source),
    ),
});

@core/blocks 신고

패키지를 신고하려면 GitHub로 로그인하세요.