Files
ipal-kit/src/modules/block-library/ui/Anchor.tsx
T
Radosław SmolińskiandClaude Opus 5.5 2d1cc0e77d Block library: 15 blocks, registry, primitives, templates, manifest, eject
- @intecion/ipal-kit/blocks: libraryBlocks() opt-in, one builder per block, field
  builders, option merging, blockLibraryManifest, faqItemsFromLayout
- @intecion/ipal-kit/blocks/rsc: createBlockRegistry, the block components and UI
  primitives (token utilities only; next/image and next/link passed in)
- @intecion/ipal-kit/templates: 10 page templates as createSeeder data
- createSeeder: { $form: title } references
- ipal-blocks eject <block>
- tests: options, rendering and a11y per block, Payload + seeding, GraphQL, admin
  wording, schema snapshot (versioning), eject imports
- shorter admin labels: link "New tab", table of contents "Show contents"

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-29 14:05:47 +01:00

21 lines
828 B
TypeScript

import type { ComponentType, ReactNode } from 'react'
/** next/link, passed in by the project (the plugin never imports next/*). */
export type LinkComponent = ComponentType<{ children?: ReactNode; className?: string; href: string; rel?: string; target?: string }>
/** An internal link through `Link` when the project passed one, otherwise a plain <a>. */
export function Anchor({ children, className, href, internal, Link, targetProps }: { children: ReactNode; className?: string; href: string; internal: boolean; Link?: LinkComponent; targetProps: Record<string, string> }) {
if (internal && Link) {
return (
<Link className={className} href={href} {...targetProps}>
{children}
</Link>
)
}
return (
<a className={className} href={href} {...targetProps}>
{children}
</a>
)
}