Files
AndreaSlopFotografie/web/src/content/packages.ts
T
SluijsensandClaude Sonnet 5.5 6f1be2f7f5 Adds a slim top bar above the packages and centres the last row of cards
The CMS serves a second banner at /api/v1/offerings/banner?position=top. The
site bakes it into the HTML at build time and replaces it live after
hydration, like the banner under the cards, and both may show at once.
The cards now sit in a wrapping flex row so an incomplete last row is centred
for any number of cards on desktop; phone and tablet stay one column.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-14 12:42:07 +01:00

35 lines
1.2 KiB
TypeScript

import type { PricingBanner, PricingPackage, PricingTopBanner } from './types';
import snapshot from './offerings.snapshot.json';
interface Offerings {
packages: PricingPackage[];
banner: PricingBanner | null;
// Missing in a generated file from before the top bar existed
topBanner?: PricingTopBanner | null;
}
// The shoot packages and the optional banner. config/fetchOfferings.ts writes
// offerings.generated.json before every build with what the CMS says; without
// it (tests, a build without CMS address, a CMS that is down) the committed
// snapshot is used. Andrea uses the small business scheme (KOR): no VAT.
// Tests always use the snapshot, so they do not depend on a build.
const generated =
import.meta.env.MODE === 'test'
? {}
: import.meta.glob<Offerings>('./offerings.generated.json', {
eager: true,
import: 'default',
});
const offerings: Offerings =
generated['./offerings.generated.json'] ?? (snapshot as Offerings);
// In display order
const packages: PricingPackage[] = offerings.packages;
export const banner: PricingBanner | null = offerings.banner;
export const topBanner: PricingTopBanner | null = offerings.topBanner ?? null;
export default packages;