Site design: type the basket page's slug instead of picking it
Like the CTA's address, the basket page is now a text box. Slashes and spaces around the slug are ignored, and Site design warns when no page has that slug. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
This commit is contained in:
parent
f20d6777ab
commit
68c67d7e96
4 changed files with 12 additions and 13 deletions
|
|
@ -64,7 +64,7 @@ export type HeaderGlobal = {
|
|||
/** The header button. Its address is also where hero buttons without one and "Book another" lead. */
|
||||
ctaButton: { label: string; href: string };
|
||||
homePage: string;
|
||||
/** Slug of the page with the Checkout block: the basket in the header and "view basket" lead here ('' = the CTA button's address). */
|
||||
/** Slug of the page with the Checkout block, typed in Site design: the basket in the header and "view basket" lead here ('' = the CTA button's address). */
|
||||
basketPage?: string;
|
||||
};
|
||||
|
||||
|
|
@ -95,7 +95,9 @@ export const defaultHeader: HeaderGlobal = {
|
|||
/** Where booking (the CTA button's address) and the basket (the basket page, else the same address) are. */
|
||||
export function shopLinks(header?: Partial<HeaderGlobal> | null) {
|
||||
const booking = header?.ctaButton?.href || '/book';
|
||||
return { booking, basket: header?.basketPage ? `/${header.basketPage}` : booking };
|
||||
// Typed by hand, so tolerate "/basket", "basket/" and spaces.
|
||||
const basketSlug = header?.basketPage?.trim().replace(/^\/+|\/+$/g, '');
|
||||
return { booking, basket: basketSlug ? `/${basketSlug}` : booking };
|
||||
}
|
||||
|
||||
export const defaultFooter: FooterGlobal = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue