keystone-design-bootstrap 1.0.48 → 1.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{blog-post-CvRhU9ss.d.ts → blog-post-D7HFCDp1.d.ts} +2 -2
- package/dist/design_system/elements/index.d.ts +25 -1
- package/dist/design_system/elements/index.js +103 -3
- package/dist/design_system/elements/index.js.map +1 -1
- package/dist/design_system/sections/index.d.ts +64 -3
- package/dist/design_system/sections/index.js +1305 -458
- package/dist/design_system/sections/index.js.map +1 -1
- package/dist/form-BLZuTGkr.d.ts +137 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +1335 -487
- package/dist/index.js.map +1 -1
- package/dist/lib/server-api.d.ts +49 -4
- package/dist/lib/server-api.js +17 -0
- package/dist/lib/server-api.js.map +1 -1
- package/dist/photos-8jMeetqV.d.ts +47 -0
- package/dist/types/index.d.ts +6 -5
- package/dist/utils/photo-helpers.d.ts +6 -15
- package/dist/utils/photo-helpers.js +10 -1
- package/dist/utils/photo-helpers.js.map +1 -1
- package/package.json +1 -1
- package/src/design_system/elements/index.tsx +4 -0
- package/src/design_system/elements/modal/modal.tsx +129 -0
- package/src/design_system/sections/index.tsx +20 -2
- package/src/design_system/sections/offer-detail.tsx +46 -0
- package/src/design_system/sections/offers-gallery.tsx +40 -0
- package/src/design_system/sections/offers-grid.tsx +108 -0
- package/src/design_system/sections/offers-section.tsx +90 -0
- package/src/design_system/sections/service-menu-section.tsx +813 -0
- package/src/lib/server-api.ts +63 -0
- package/src/types/api/photos.ts +11 -10
- package/src/types/api/service.ts +21 -0
- package/src/utils/photo-helpers.ts +3 -14
- package/dist/company-information-C_k_sLSB.d.ts +0 -46
- package/dist/form-CWXC-IHT.d.ts +0 -88
- package/dist/website-photos-_n2g24IM.d.ts +0 -20
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { PhotoWithFallback } from '../elements';
|
|
5
|
+
import type { OfferPublic } from '../../lib/server-api';
|
|
6
|
+
import type { WebsitePhotos } from '../../types/api/website-photos';
|
|
7
|
+
import type { CompanyInformation } from '../../types/api/company-information';
|
|
8
|
+
|
|
9
|
+
export interface OffersGridProps {
|
|
10
|
+
offers: OfferPublic[] | null;
|
|
11
|
+
title?: string;
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
websitePhotos?: WebsitePhotos | null;
|
|
14
|
+
companyInformation?: CompanyInformation | null;
|
|
15
|
+
backgroundColor?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Full offers page: grid of cards with photo or gradient fallback (view-only). */
|
|
19
|
+
export function OffersGrid({
|
|
20
|
+
offers,
|
|
21
|
+
title = 'Offers',
|
|
22
|
+
subtitle = 'See our current offers.',
|
|
23
|
+
websitePhotos,
|
|
24
|
+
companyInformation,
|
|
25
|
+
backgroundColor = 'bg-primary',
|
|
26
|
+
}: OffersGridProps) {
|
|
27
|
+
const list = Array.isArray(offers) ? offers : [];
|
|
28
|
+
const displayList = list.filter((o) => !o.expired);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<section className={`${backgroundColor} py-16 md:py-24`}>
|
|
32
|
+
<div className="mx-auto max-w-container px-4 md:px-8">
|
|
33
|
+
<div className="mx-auto max-w-3xl text-center">
|
|
34
|
+
<h1 className="text-display-sm font-semibold text-primary md:text-display-md">
|
|
35
|
+
{title}
|
|
36
|
+
</h1>
|
|
37
|
+
{subtitle && (
|
|
38
|
+
<p className="mt-4 text-lg text-tertiary md:mt-5 md:text-xl">{subtitle}</p>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
{displayList.length > 0 ? (
|
|
43
|
+
<ul className="mx-auto mt-12 grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3">
|
|
44
|
+
{displayList.map((offer, index) => (
|
|
45
|
+
<li key={offer.id}>
|
|
46
|
+
<OffersGridCard
|
|
47
|
+
offer={offer}
|
|
48
|
+
index={index}
|
|
49
|
+
websitePhotos={websitePhotos}
|
|
50
|
+
companyInformation={companyInformation}
|
|
51
|
+
/>
|
|
52
|
+
</li>
|
|
53
|
+
))}
|
|
54
|
+
</ul>
|
|
55
|
+
) : (
|
|
56
|
+
<div className="mx-auto mt-12 max-w-md text-center">
|
|
57
|
+
<p className="text-tertiary">No offers available at the moment. Check back later.</p>
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
60
|
+
</div>
|
|
61
|
+
</section>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function OffersGridCard({
|
|
66
|
+
offer,
|
|
67
|
+
index,
|
|
68
|
+
websitePhotos,
|
|
69
|
+
companyInformation,
|
|
70
|
+
}: {
|
|
71
|
+
offer: OfferPublic;
|
|
72
|
+
index: number;
|
|
73
|
+
websitePhotos?: WebsitePhotos | null;
|
|
74
|
+
companyInformation?: CompanyInformation | null;
|
|
75
|
+
}) {
|
|
76
|
+
return (
|
|
77
|
+
<article className="flex flex-col overflow-hidden rounded-2xl border border-secondary bg-secondary/30">
|
|
78
|
+
<div className="aspect-[4/3] w-full overflow-hidden">
|
|
79
|
+
<PhotoWithFallback
|
|
80
|
+
item={undefined}
|
|
81
|
+
fallbackId={offer.id ?? index}
|
|
82
|
+
alt={offer.name}
|
|
83
|
+
className="size-full object-cover"
|
|
84
|
+
websitePhotos={websitePhotos}
|
|
85
|
+
companyInformation={companyInformation}
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
<div className="flex flex-1 flex-col gap-3 p-5 md:p-6">
|
|
89
|
+
<h2 className="text-lg font-semibold text-primary">{offer.name}</h2>
|
|
90
|
+
{offer.description && (
|
|
91
|
+
<p className="text-tertiary line-clamp-2">{offer.description}</p>
|
|
92
|
+
)}
|
|
93
|
+
{offer.value_terms && (
|
|
94
|
+
<p className="text-sm font-medium text-primary">{offer.value_terms}</p>
|
|
95
|
+
)}
|
|
96
|
+
{offer.expires_at && (() => {
|
|
97
|
+
const d = new Date(offer.expires_at);
|
|
98
|
+
if (Number.isNaN(d.getTime())) return null;
|
|
99
|
+
return (
|
|
100
|
+
<p className="text-xs text-tertiary">
|
|
101
|
+
Expires {d.toLocaleDateString()}
|
|
102
|
+
</p>
|
|
103
|
+
);
|
|
104
|
+
})()}
|
|
105
|
+
</div>
|
|
106
|
+
</article>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { OfferPublic } from '../../lib/server-api';
|
|
4
|
+
import type { WebsitePhotos } from '../../types/api/website-photos';
|
|
5
|
+
import type { CompanyInformation } from '../../types/api/company-information';
|
|
6
|
+
import { Button } from '../elements';
|
|
7
|
+
|
|
8
|
+
export interface OffersSectionProps {
|
|
9
|
+
offers: OfferPublic[] | null;
|
|
10
|
+
title?: string;
|
|
11
|
+
subtitle?: string;
|
|
12
|
+
maxOffers?: number;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
showViewAll?: boolean;
|
|
15
|
+
websitePhotos?: WebsitePhotos | null;
|
|
16
|
+
companyInformation?: CompanyInformation | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Embeddable offers section (view-only). Renders nothing if no offers. */
|
|
20
|
+
export function OffersSection({
|
|
21
|
+
offers,
|
|
22
|
+
title = 'Offers',
|
|
23
|
+
subtitle = 'See our current offers.',
|
|
24
|
+
maxOffers = 6,
|
|
25
|
+
backgroundColor = 'bg-primary',
|
|
26
|
+
showViewAll = true,
|
|
27
|
+
}: OffersSectionProps) {
|
|
28
|
+
const list = Array.isArray(offers) ? offers : [];
|
|
29
|
+
const displayList = list.filter((o) => !o.expired).slice(0, maxOffers);
|
|
30
|
+
|
|
31
|
+
if (list.length === 0) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<section className={`${backgroundColor} py-16 md:py-24`}>
|
|
37
|
+
<div className="mx-auto max-w-container px-4 md:px-8">
|
|
38
|
+
<div className="flex flex-col items-start justify-between lg:flex-row">
|
|
39
|
+
<div className="max-w-3xl">
|
|
40
|
+
<p className="text-sm font-semibold text-brand-secondary md:text-md">Current offers</p>
|
|
41
|
+
<h2 className="mt-3 text-display-sm font-semibold text-primary md:text-display-md">
|
|
42
|
+
{title}
|
|
43
|
+
</h2>
|
|
44
|
+
<p className="mt-4 text-lg text-tertiary md:mt-5 md:text-xl">{subtitle}</p>
|
|
45
|
+
</div>
|
|
46
|
+
{showViewAll && (
|
|
47
|
+
<div className="hidden gap-3 lg:flex">
|
|
48
|
+
<Button size="xl" href="/offers">View all offers</Button>
|
|
49
|
+
</div>
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
<div className="mx-auto mt-12 max-w-2xl space-y-6">
|
|
53
|
+
{displayList.map((offer) => (
|
|
54
|
+
<OfferCard key={offer.id} offer={offer} />
|
|
55
|
+
))}
|
|
56
|
+
</div>
|
|
57
|
+
{showViewAll && (
|
|
58
|
+
<div className="mt-12 flex flex-col gap-3 lg:hidden">
|
|
59
|
+
<Button size="xl" href="/offers">View all offers</Button>
|
|
60
|
+
</div>
|
|
61
|
+
)}
|
|
62
|
+
</div>
|
|
63
|
+
</section>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function OfferCard({ offer }: { offer: OfferPublic }) {
|
|
68
|
+
return (
|
|
69
|
+
<div className="rounded-2xl border border-secondary bg-secondary/30 p-5 md:p-6">
|
|
70
|
+
<div className="flex flex-col gap-3">
|
|
71
|
+
<h3 className="text-lg font-semibold text-primary">{offer.name}</h3>
|
|
72
|
+
{offer.description && (
|
|
73
|
+
<p className="text-tertiary">{offer.description}</p>
|
|
74
|
+
)}
|
|
75
|
+
{offer.value_terms && (
|
|
76
|
+
<p className="text-sm font-medium text-primary">{offer.value_terms}</p>
|
|
77
|
+
)}
|
|
78
|
+
{offer.expires_at && (() => {
|
|
79
|
+
const d = new Date(offer.expires_at);
|
|
80
|
+
if (Number.isNaN(d.getTime())) return null;
|
|
81
|
+
return (
|
|
82
|
+
<p className="text-xs text-tertiary">
|
|
83
|
+
Expires {d.toLocaleDateString()}
|
|
84
|
+
</p>
|
|
85
|
+
);
|
|
86
|
+
})()}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|