Block library: fixes from the first visual test on the reference site
- CMSLink: a link that wraps content (a logo, a card) and leads nowhere keeps the
content — an empty link group ({ type: 'internal' }) no longer hides logos
- entryList: field `collection` → `entryCollection` (Mongoose reserves
`collection`; unreleased, snapshot updated) + a test against reserved names
- post template starts with a page hero holding the title (the page's h1)
- legal and cookie policy templates set noindex: true (AGENT.md §0c)
- hero background: a full bg-overlay scrim under the text
- MediaValue accepts any object (generated Media types fit without a cast)
- contact: Turnstile renders dark in an inverted section
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
51f80cea13
commit
29ede3ad4b
@@ -11,7 +11,7 @@ import { cx } from './cx.js'
|
||||
export type ResolveLink = (link: LinkData, locale: string) => null | Promise<null | ResolvedLink> | ResolvedLink
|
||||
|
||||
export type CMSLinkProps = {
|
||||
/** For a link that wraps something (a card, an image): the content instead of the label. */
|
||||
/** For a link that wraps something (a card, an image): the content instead of the label — shown without a link when the link leads nowhere. */
|
||||
children?: ReactNode
|
||||
className?: string
|
||||
link: LinkData
|
||||
@@ -28,9 +28,12 @@ export async function CMSLink({
|
||||
locale,
|
||||
resolve,
|
||||
}: { buttonClass?: (appearance?: null | string) => string; Link?: LinkComponent; resolve: ResolveLink } & CMSLinkProps) {
|
||||
const l = await resolve(link, locale)
|
||||
const content = children ?? l?.label
|
||||
if (!l || !content) {return null}
|
||||
const l = link ? await resolve(link, locale) : null
|
||||
// A link that wraps something (a logo, a card) and leads nowhere — an empty link group, a deleted page —
|
||||
// keeps its content as it is; a plain text link without a target renders nothing.
|
||||
if (!l) {return children ?? null}
|
||||
const content = children ?? l.label
|
||||
if (!content) {return null}
|
||||
const cls = cx(buttonClass(l.appearance), className) || undefined
|
||||
return (
|
||||
<Anchor className={cls} href={l.href} internal={l.internal} Link={Link} targetProps={l.targetProps}>
|
||||
|
||||
Reference in New Issue
Block a user