KO
베타 번역

@core / blocks

1.0.0 ▾
인증됨MIT
GitHub

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

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

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

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

export const logos = defineBlock({
  type: 'logos',
  label: 'Logos',
  icon: 'image',
  schema: z.object({
    title: optText(160),
    items: z.array(z.object({ name: text(100), image: mediaId, href })).min(1).max(24),
  }),
  fields: [
    { name: 'title', label: 'Title', type: 'text' },
    {
      name: 'items',
      label: 'Logos',
      type: 'list',
      required: true,
      fields: [
        { name: 'name', label: 'Name (used as alt text)', type: 'text', required: true },
        { name: 'image', label: 'Logo', type: 'media' },
        { name: 'href', label: 'Link', type: 'url' },
      ],
    },
  ],
  defaults: () => ({ items: [{ name: 'Company' }] }),
  Component: ({ data, ctx }) =>
    h(
      Section,
      { id: ctx.id, block: 'logos', title: data.title, ctx, label: 'Logos' },
      h(
        'ul',
        { className: 'blk-logos', role: 'list' },
        data.items.map((it, i) => {
          const img = ctx.image(it.image);
          const content = img ? h(Img, { image: img, alt: it.name }) : h('span', null, it.name);
          return h('li', { key: i }, it.href ? h('a', { href: it.href, rel: 'noopener noreferrer' }, content) : content);
        }),
      ),
    ),
});

@core/blocks 신고

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