@stackshift-ui/blog 6.0.5 → 6.0.7-beta.0

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/src/types.ts ADDED
@@ -0,0 +1,414 @@
1
+ export type StyleVariants<T extends string> = Record<T, string>;
2
+
3
+ export type Socials = "facebook" | "instagram" | "youtube" | "linkedin" | "twitter";
4
+ export interface MainImage {
5
+ image: string;
6
+ alt?: string;
7
+ }
8
+
9
+ export interface LabeledRoute extends ConditionalLink {
10
+ ariaLabel?: string;
11
+ label?: string;
12
+ linkTarget?: string;
13
+ linkType?: string;
14
+ _type?: string;
15
+ linkInternal?: any;
16
+ }
17
+ export interface ConditionalLink {
18
+ type?: string;
19
+ internalLink?: string | null;
20
+ externalLink?: string | null;
21
+ }
22
+
23
+ export interface StatItems {
24
+ label?: string;
25
+ mainImage?: MainImage;
26
+ value?: string;
27
+ _key?: string;
28
+ _type?: string;
29
+ }
30
+
31
+ export interface Logo extends ConditionalLink {
32
+ alt?: string;
33
+ linkTarget?: string;
34
+ image?: string;
35
+ }
36
+
37
+ export interface Images {
38
+ image?: string;
39
+ _key?: string;
40
+ _type?: string;
41
+ alt?: string;
42
+ }
43
+
44
+ export interface ContactDetails {
45
+ addressInfo?: string;
46
+ contactInfo?: string;
47
+ emailInfo?: string;
48
+ _key?: string;
49
+ }
50
+
51
+ export interface SocialLink {
52
+ socialMedia?: string | null;
53
+ socialMediaLink?: string | null;
54
+ _key?: string | null;
55
+ _type?: string | null;
56
+ socialMediaIcon?: {
57
+ alt?: string;
58
+ image?: string;
59
+ } | null;
60
+ socialMediaPlatform?: string | null;
61
+ }
62
+
63
+ export interface LabeledRouteWithKey extends LabeledRoute {
64
+ _key?: string;
65
+ }
66
+
67
+ export interface ArrayOfImageTitleAndText {
68
+ mainImage?: {
69
+ alt?: string;
70
+ image?: string;
71
+ };
72
+ plainText?: string;
73
+ title?: string;
74
+ _key?: string;
75
+ _type?: string;
76
+ }
77
+
78
+ export interface FeaturedItem {
79
+ description?: string;
80
+ mainImage?: MainImage;
81
+ title?: string;
82
+ subtitle?: string;
83
+ _key?: string;
84
+ _type?: string;
85
+ }
86
+
87
+ export interface ArrayOfTitleAndText {
88
+ _key?: string;
89
+ plainText?: string;
90
+ title?: string;
91
+ }
92
+
93
+ export interface BlogPost extends SanityBody {
94
+ authors?: Author[] | null;
95
+ body?: any;
96
+ categories?: Category[] | null;
97
+ excerpt?: string | null;
98
+ link?: string | null;
99
+ mainImage?: string | null;
100
+ alt?: string | null;
101
+ publishedAt?: string;
102
+ seo?: Seo | null;
103
+ slug?: SanitySlug | null;
104
+ title?: string;
105
+ }
106
+
107
+ export interface Seo {
108
+ _type?: string;
109
+ seoTitle?: string;
110
+ seoDescription?: string;
111
+ seoImage?: string;
112
+ seoKeywords?: string;
113
+ seoSynonyms?: string;
114
+ }
115
+
116
+ export interface SanitySlug {
117
+ current?: string;
118
+ _type?: "slug";
119
+ }
120
+
121
+ export interface SanityBody {
122
+ _createdAt?: string;
123
+ _id?: string;
124
+ _rev?: string;
125
+ _type?: string;
126
+ _updatedAt?: string;
127
+ }
128
+
129
+ export interface Author extends SanityBody {
130
+ link?: string | null;
131
+ bio?: string | null;
132
+ name?: string | null;
133
+ slug?: SanitySlug | null;
134
+ image?: string | null;
135
+ profile?: {
136
+ alt: string;
137
+ image: string;
138
+ } | null;
139
+ }
140
+
141
+ export interface Category extends SanityBody {
142
+ title?: string;
143
+ }
144
+
145
+ export interface Form {
146
+ id?: string | null;
147
+ buttonLabel?: string | null;
148
+ name?: string | null;
149
+ subtitle?: string | null;
150
+ fields?: FormFields[] | null;
151
+ thankYouPage?: ThankYouPage | null;
152
+ }
153
+
154
+ export interface FormFields {
155
+ name?: string;
156
+ placeholder?: string;
157
+ pricingType?: string;
158
+ type?: FormTypes;
159
+ _key?: string;
160
+ _type?: string;
161
+ isRequired?: boolean;
162
+ label?: string;
163
+ items?: string[];
164
+ }
165
+
166
+ export type FormTypes =
167
+ | "inputText"
168
+ | "inputEmail"
169
+ | "inputPassword"
170
+ | "inputNumber"
171
+ | "textarea"
172
+ | "inputFile"
173
+ | "inputRadio"
174
+ | "inputCheckbox"
175
+ | "inputSelect";
176
+
177
+ export interface ThankYouPage {
178
+ externalLink?: string | null;
179
+ internalLink?: string | null;
180
+ linkInternal?: any;
181
+ linkTarget?: string;
182
+ linkType?: string;
183
+ type?: string;
184
+ }
185
+
186
+ //Used on different sections
187
+ export interface SectionsProps {
188
+ template?: Template;
189
+ data?: Sections;
190
+ variant?: string | null | undefined;
191
+ schema?: Variants;
192
+ }
193
+
194
+ export interface Sections extends SanityBody {
195
+ label?: string;
196
+ variant?: string;
197
+ variants?: Variants;
198
+ _key?: string;
199
+ }
200
+
201
+ //*EDIT THIS SECTION WHEN CREATING/UPDATING SCHEMAS ON STUDIO */
202
+ export interface Variants {
203
+ template?: Template;
204
+ multipleMenus?: any;
205
+ arrayOfTitleAndText?: ArrayOfTitleAndText[] | null;
206
+ logo?: Logo | null;
207
+ primaryButton?: LabeledRoute | null;
208
+ secondaryButton?: LabeledRoute | null;
209
+ routes?: LabeledRouteWithKey[] | null;
210
+ menu?: LabeledRouteWithKey[] | null;
211
+ plans?: Plans[] | null;
212
+ formLinks?: LabeledRouteWithKey[] | null;
213
+ portfolios?: Portfolios[] | null;
214
+ portfoliosWithCategories?: PortfoliosWithCategories[] | null;
215
+ length?: number;
216
+ signInLink?: LabeledRoute | null;
217
+ signinLink?: LabeledRoute | null;
218
+ tags?: string[] | null;
219
+ posts?: BlogPost[] | null;
220
+ blogPosts?: BlogPost[] | null;
221
+ blogsPerPage?: number | null;
222
+ form?: Form | null;
223
+ collections?: Collection | null;
224
+ products?: CollectionProduct | null;
225
+ allProducts?: Collection[];
226
+ subtitle?: string | null;
227
+ caption?: string | null;
228
+ title?: string | null;
229
+ plainText?: string | null;
230
+ contactDescription?: string | null;
231
+ officeInformation?: string | null;
232
+ contactEmail?: string | null;
233
+ contactNumber?: string | null;
234
+ socialLinks?: SocialLink[] | null;
235
+ block?: any;
236
+ heading?: string | null;
237
+ acceptButtonLabel?: string | null;
238
+ declineButtonLabel?: string | null;
239
+ faqsWithCategories?: FaqsWithCategory[] | null;
240
+ faqs?: AskedQuestion[] | null;
241
+ arrayOfImageTitleAndText?: ArrayOfImageTitleAndText[] | null;
242
+ description?: string | null;
243
+ featuredItems?: FeaturedItem[] | null;
244
+ images?: Images[] | null;
245
+ contactDetails?: ContactDetails[] | null;
246
+ copyright?: string | null;
247
+ mainImage?: MainImage | null;
248
+ youtubeLink?: string | null;
249
+ banner?: any;
250
+ stats?: StatItems[] | null;
251
+ teams?: Team[] | null;
252
+ testimonials?: Testimonial[] | null;
253
+ selectStripeAccount?: string;
254
+ annualBilling?: string;
255
+ monthlyBilling?: string;
256
+ productDetails?: ProductDetail[];
257
+ btnLabel?: string;
258
+ selectAccount?: string;
259
+ hashtags?: string[];
260
+ numberOfPosts?: number;
261
+ text?: string;
262
+ button?: LabeledRoute;
263
+ features?: string[];
264
+ config?: {
265
+ enableAnalytics: boolean;
266
+ cookiePolicy?: {
267
+ siteName: string;
268
+ cookiePolicyPage: Reference;
269
+ };
270
+ consentModalPosition?: string;
271
+ };
272
+ contactLink?: LabeledRoute;
273
+ }
274
+
275
+ export interface Template {
276
+ bg?: string;
277
+ color?: string;
278
+ }
279
+
280
+ export type Plans = {
281
+ _key?: string | null;
282
+ _type?: "planItems" | null;
283
+ checkoutButtonName?: string | null;
284
+ description?: string | null;
285
+ monthlyPrice?: string | null;
286
+ planType?: string | null;
287
+ yearlyPrice?: string | null;
288
+ planIncludes?: string[] | null;
289
+ primaryButton?: LabeledRoute | null;
290
+ } & Record<string, string>;
291
+
292
+ export interface Portfolios {
293
+ dateAdded?: string | null;
294
+ mainImage?: {
295
+ image?: string | null;
296
+ alt?: string | null;
297
+ } | null;
298
+ primaryButton?: LabeledRoute | null;
299
+ title?: string | null;
300
+ _key?: string | null;
301
+ _type?: string | null;
302
+ }
303
+
304
+ export interface PortfoliosWithCategories {
305
+ category?: string | null;
306
+ content?: Content[] | null;
307
+ primaryButton?: LabeledRoute | null;
308
+ _key?: string | null;
309
+ _type?: string | null;
310
+ }
311
+
312
+ export interface Content extends Portfolios {
313
+ description?: string | null;
314
+ subtitle?: string | null;
315
+ }
316
+
317
+ export interface Collection extends SanityBody {
318
+ collectionInfoVariant?: {
319
+ variant?: string;
320
+ } | null;
321
+ name?: string | null;
322
+ products?: CollectionProduct[] | null;
323
+ sections?: any; //todo
324
+ seo?: Seo | null;
325
+ slug?: SanitySlug | null;
326
+ }
327
+
328
+ export interface CollectionProduct extends SanityBody {
329
+ compareToPrice?: number | null;
330
+ description?: string | null;
331
+ ecwidProductId?: number | null;
332
+ name?: string | null;
333
+ price?: number | null;
334
+ productInfo?: ProductInfo | null;
335
+ productInfoVariant?: {
336
+ variant?: string;
337
+ } | null;
338
+ sections?: any; //todo
339
+ seo?: Seo | null;
340
+ slug?: SanitySlug | null;
341
+ }
342
+
343
+ //TODO, RECHECK PRODUCT INFO DATA FROM SANITY
344
+ interface ProductInfo {
345
+ btnLabel?: string | null;
346
+ images?: ProductInfoImage[] | null;
347
+ productDetails?: ProductDetail[] | null;
348
+ socialLinks?: SocialLink[] | null;
349
+ subtitle?: string | null;
350
+ }
351
+
352
+ //TODO, RECHECK PRODUCT INFO DATA FROM SANITY
353
+ export interface ProductDetail {
354
+ blockContent?: any;
355
+ contentType?: string;
356
+ tabName?: string;
357
+ _key?: string;
358
+ [key: string]: any;
359
+ }
360
+ interface ProductInfoImage {
361
+ alt?: string | null;
362
+ _key: string;
363
+ _type: string;
364
+ image?: string | null;
365
+ }
366
+
367
+ export interface FaqsWithCategory {
368
+ askedQuestions?: AskedQuestion[] | null;
369
+ category?: string | null;
370
+ _key?: string;
371
+ _type?: string;
372
+ }
373
+
374
+ export interface AskedQuestion {
375
+ answer?: string | null;
376
+ question?: string | null;
377
+ hidden?: boolean;
378
+ _key?: string;
379
+ _type?: string;
380
+ }
381
+
382
+ export interface Team {
383
+ jobTitle?: string;
384
+ mainImage?: MainImage;
385
+ name?: string;
386
+ plainText?: string;
387
+ _key?: string;
388
+ _type?: string;
389
+ }
390
+
391
+ export interface Testimonial {
392
+ jobTitle?: string;
393
+ mainImage?: MainImage;
394
+ name?: string;
395
+ rating?: string;
396
+ testimony?: string;
397
+ _key?: string;
398
+ _type?: string;
399
+ }
400
+
401
+ export declare interface Reference {
402
+ _type: string;
403
+ _ref: string;
404
+ _key?: string;
405
+ _weak?: boolean;
406
+ _strengthenOnPublish?: {
407
+ type: string;
408
+ weak?: boolean;
409
+ template?: {
410
+ id: string;
411
+ params: Record<string, string | number | boolean>;
412
+ };
413
+ };
414
+ }
@@ -1 +0,0 @@
1
- import{a as o}from"./chunk-TMLYY2AQ.mjs";import{a as m}from"./chunk-PC6NMI3O.mjs";import{Button as u}from"@stackshift-ui/button";import{Container as f}from"@stackshift-ui/container";import{Flex as c}from"@stackshift-ui/flex";import{Heading as b}from"@stackshift-ui/heading";import{Image as d}from"@stackshift-ui/image";import{Link as h}from"@stackshift-ui/link";import{Section as v}from"@stackshift-ui/section";import{Text as g}from"@stackshift-ui/text";import{Fragment as z,jsx as l,jsxs as t}from"react/jsx-runtime";function w({subtitle:e,title:i,posts:a,primaryButton:n}){return l(v,{className:"py-20 bg-background",children:t(f,{maxWidth:1280,children:[l(x,{subtitle:e,title:i}),l(P,{posts:a,count:0,blogsPerPage:5}),l(k,{primaryButton:n})]})})}function x({subtitle:e,title:i}){return t("div",{className:"w-full mb-16 text-center",children:[e?l(g,{weight:"bold",className:"text-secondary",children:e}):null,i?l(b,{fontSize:"3xl",children:i}):null]})}function P({posts:e,count:i,blogsPerPage:a}){return t(c,{wrap:!0,justify:"center",className:"mb-16",gap:4,children:[l("div",{className:"w-full lg:w-[45%]",children:e==null?void 0:e.slice(i,i+1).map((n,r)=>l(s,{size:"lg",post:n},r))}),l(c,{wrap:!0,className:"w-full lg:w-[45%]",gap:4,children:e==null?void 0:e.slice(i+1,a).map((n,r)=>l("div",{className:"w-full lg:basis-[45%]",children:l(s,{post:n,size:"sm"})},r))})]})}function s({post:e,size:i}){let a=o("1024");return t("div",{className:"overflow-hidden rounded-global shadow",children:[e!=null&&e.mainImage?l(N,{post:e,size:i,breakpoints:a}):null,t("div",{className:"p-6 bg-white flex flex-col justify-between",style:{height:"295px"},children:[t("div",{children:[e!=null&&e.publishedAt?l(g,{muted:!0,className:"text-sm",children:m(new Date(e.publishedAt)," dd MMM, yyyy")}):null,e!=null&&e.title?l(b,{type:"h4",className:"my-2",children:e.title.length>25?`${e.title.substring(0,25)}...`:e.title}):null,e!=null&&e.excerpt?l(g,{muted:!0,className:"mb-6 text-justify",children:e.excerpt.length>41?`${e.excerpt.substring(0,41)}...`:e.excerpt}):null]}),e!=null&&e.link?l(h,{"aria-label":"View Blog Post",className:"font-bold text-primary hover:text-secondary",href:`/${e==null?void 0:e.link}`,children:"View Blog Post"}):null]})]})}function N({post:e,size:i,breakpoints:a}){return l(z,{children:a?l(d,{className:"object-cover w-full overflow-hidden",src:`${e.mainImage}`,sizes:"100vw",style:{width:"100%",height:"auto",objectFit:"cover"},width:271,height:248,alt:`blog-variantB-image-${e.title}`}):l("div",{className:`${i==="lg"?"h-[44.5rem]":"h-[12.5rem]"}`,children:l(d,{className:"object-cover w-full overflow-hidden rounded-t-global",src:`${e.mainImage}`,sizes:"100vw",style:{width:"100%",height:"100%",objectFit:"cover"},width:271,height:248,alt:`blog-variantB-image-${e.title}`})})})}function k({primaryButton:e}){return e!=null&&e.label?l("div",{className:"text-center",children:l(u,{as:"link",link:e,ariaLabel:e==null?void 0:e.label,children:e==null?void 0:e.label})}):null}export{w as a};
@@ -1 +0,0 @@
1
- import{a as v}from"./chunk-TMLYY2AQ.mjs";import{a as h}from"./chunk-PC6NMI3O.mjs";import{Badge as T}from"@stackshift-ui/badge";import{Button as F}from"@stackshift-ui/button";import{Container as L}from"@stackshift-ui/container";import{Flex as c}from"@stackshift-ui/flex";import{Heading as t}from"@stackshift-ui/heading";import{Image as y}from"@stackshift-ui/image";import{Link as C}from"@stackshift-ui/link";import{Section as I}from"@stackshift-ui/section";import{Text as d}from"@stackshift-ui/text";import M from"react";import{Fragment as B,jsx as l,jsxs as m}from"react/jsx-runtime";function R({subtitle:e,title:a,posts:g,primaryButton:i}){return l(I,{className:"py-20 bg-background",children:m(L,{maxWidth:1280,children:[m(c,{align:"center",justify:"between",className:"flex-col mb-16 md:flex-row",gap:4,children:[l(S,{subtitle:e,title:a}),l(P,{primaryButton:i})]}),l($,{posts:g,blogsPerPage:3}),l(P,{primaryButton:i})]})})}function S({subtitle:e,title:a}){return m("div",{className:"text-center md:text-left",children:[e?l(d,{weight:"bold",className:"text-primary",children:e}):null,a?l(t,{fontSize:"3xl",children:a}):null]})}function $({posts:e,blogsPerPage:a}){var g;return e?l("div",{children:(g=e==null?void 0:e.slice(0,a))==null?void 0:g.map((i,r)=>l("div",{className:"flex flex-wrap mb-8 overflow-hidden rounded-global shadow",children:l(A,{post:i,className:`${r%2===0?"flex-row":"flex-row-reverse"}`},r)},r))}):null}function A({post:e,className:a}){var r,b,x,u,w,N;let i=v("1100")?70:200;return m(c,{wrap:!0,className:`bg-white overflow-hidden rounded-lg shadow w-full ${a}`,children:[(e==null?void 0:e.mainImage)&&l(y,{className:"object-cover w-full h-auto rounded-l lg:w-1/2",src:`${e==null?void 0:e.mainImage}`,sizes:"100vw",width:554,height:416,alt:"blog-variantC-image-"}),m("div",{className:"w-full px-6 py-6 rounded-r lg:w-1/2 lg:pt-10",children:[l(c,{gap:2,children:(e==null?void 0:e.categories)&&((r=e==null?void 0:e.categories)==null?void 0:r.map((n,f)=>l(T,{className:" bg-secondary-foreground text-primary",children:n==null?void 0:n.title},f)))}),(e==null?void 0:e.publishedAt)&&l(d,{muted:!0,className:"m-1",children:h(new Date(e==null?void 0:e.publishedAt)," dd MMM, yyyy")}),(e==null?void 0:e.title)&&l(t,{className:"my-4",type:"h3",children:((b=e==null?void 0:e.title)==null?void 0:b.length)>40?((x=e==null?void 0:e.title)==null?void 0:x.substring(0,40))+"...":e==null?void 0:e.title}),(e==null?void 0:e.authors)&&m("div",{className:"flex mb-10 flex-wrap",children:[l("span",{className:"italic text-primary",children:"By\xA0"}),(u=e==null?void 0:e.authors)==null?void 0:u.map((n,f,{length:k})=>m(B,{children:[l(d,{className:"italic text-primary",children:n==null?void 0:n.name}),f+1!==k?l("span",{children:"\xA0,\xA0"}):null]}))]}),(e==null?void 0:e.excerpt)&&l(d,{muted:!0,className:"mb-6 leading-loose text-justify",children:((w=e==null?void 0:e.excerpt)==null?void 0:w.length)>i?((N=e==null?void 0:e.excerpt)==null?void 0:N.substring(0,i))+"...":e==null?void 0:e.excerpt}),(e==null?void 0:e.link)&&l(C,{"aria-label":"View Blog Post",className:"font-bold text-primary hover:text-primary-foreground",href:`/${e==null?void 0:e.link}`,children:"View Blog Post"})]})]})}function P({primaryButton:e}){return e!=null&&e.label?l(M.Fragment,{children:l(F,{as:"link",link:e,ariaLabel:e==null?void 0:e.label,children:e==null?void 0:e.label})}):null}export{R as a};
@@ -1 +0,0 @@
1
- import{a as t}from"./chunk-PC6NMI3O.mjs";import{Button as b}from"@stackshift-ui/button";import{Container as v}from"@stackshift-ui/container";import{Flex as x}from"@stackshift-ui/flex";import{Heading as w}from"@stackshift-ui/heading";import{Image as h}from"@stackshift-ui/image";import{Link as N}from"@stackshift-ui/link";import{Section as o}from"@stackshift-ui/section";import{Text as k}from"@stackshift-ui/text";import{jsx as l,jsxs as d}from"react/jsx-runtime";function P({subtitle:e,title:i,posts:a,primaryButton:n}){return l(o,{className:"py-20 bg-background",children:d(v,{maxWidth:1280,children:[l(y,{subtitle:e,title:i}),l(A,{posts:a}),l(L,{primaryButton:n})]})})}function y({subtitle:e,title:i}){return d("div",{className:"mb-16 text-center",children:[e?l(k,{weight:"bold",className:"text-secondary",children:e}):null,i?l(w,{fontSize:"3xl",children:i}):null]})}function A({posts:e}){var n,c,g,u;if(!e)return null;let i=6,a=0;return d(x,{gap:4,className:"flex-col lg:flex-row",children:[d("div",{className:"w-full space-y-5 lg:w-1/2",children:[(n=e==null?void 0:e.slice(a,a+1))==null?void 0:n.map((m,r)=>l(f,{post:m},r)),l(x,{gap:4,className:"flex-col lg:flex-row",children:(c=e==null?void 0:e.slice(a+1,a+3))==null?void 0:c.map((m,r)=>l(f,{post:m},r))})]}),d("div",{className:"w-full space-y-5 lg:w-1/2",children:[l(x,{gap:4,className:"flex-col lg:flex-row",children:(g=e==null?void 0:e.slice(a+3,a+5))==null?void 0:g.map((m,r)=>l(f,{post:m},r))}),(u=e==null?void 0:e.slice(a+5,i))==null?void 0:u.map((m,r)=>l(f,{post:m},r))]})]})}function f({post:e}){var i,a;return d("div",{className:"relative w-full h-64 rounded",children:[e!=null&&e.mainImage?l(h,{className:"relative object-cover w-full h-full overflow-hidden rounded-global",src:`${e==null?void 0:e.mainImage}`,alt:"blog-variantA-image",sizes:"(min-width: 1540px) 740px, (min-width: 1280px) 612px, (min-width: 1040px) 484px, (min-width: 780px) 736px, (min-width: 680px) 608px, calc(94.44vw - 15px)"}):null,l("div",{className:"absolute inset-0 bg-gray-900 rounded-global opacity-75"}),d("div",{className:"absolute inset-0 flex flex-col items-start p-6",children:[e!=null&&e.categories?l("div",{className:"absolute flex left-5 top-5",children:(i=e==null?void 0:e.categories)==null?void 0:i.map((n,c)=>l("span",{className:"px-3 py-1 mb-auto mr-3 text-sm font-bold uppercase bg-white rounded-full text-primary",children:n==null?void 0:n.title},c))}):null,l("span",{className:"mt-auto text-sm text-gray-500",children:e!=null&&e.publishedAt?t(new Date(e==null?void 0:e.publishedAt),"dd MMM, yyyy"):""}),e!=null&&e.title?l(N,{className:"text-lg font-bold text-white transform hover:scale-110 hover:text-secondary motion-reduce:transform-none",href:`/${e==null?void 0:e.link}`,children:((a=e==null?void 0:e.title)==null?void 0:a.length)>40?(e==null?void 0:e.title.substring(0,40))+"...":e==null?void 0:e.title}):null]})]})}function L({primaryButton:e}){return e!=null&&e.label?l("div",{className:"mt-10 text-center",children:l(b,{as:"link",link:e,ariaLabel:e==null?void 0:e.label,children:e==null?void 0:e.label})}):null}export{P as a};
@@ -1 +0,0 @@
1
- import{a as N}from"./chunk-PC6NMI3O.mjs";import{Button as y}from"@stackshift-ui/button";import{Card as I}from"@stackshift-ui/card";import{Container as M}from"@stackshift-ui/container";import{Flex as x}from"@stackshift-ui/flex";import{Heading as C}from"@stackshift-ui/heading";import{Image as F}from"@stackshift-ui/image";import{Input as $}from"@stackshift-ui/input";import{Link as E}from"@stackshift-ui/link";import{Section as H}from"@stackshift-ui/section";import{Text as v}from"@stackshift-ui/text";import o from"react";import{jsx as n,jsxs as c}from"react/jsx-runtime";function R({subtitle:e,title:t,posts:i}){let[l,u]=o.useState("All"),[r,b]=o.useState(1),[w,k]=o.useState(""),f=6;o.useEffect(()=>{b(1)},[l]);let h=(i!=null?i:[]).flatMap(a=>{var g;return((g=a==null?void 0:a.categories)!=null?g:[]).map(d=>({category:d==null?void 0:d.title,title:a==null?void 0:a.title,slug:a==null?void 0:a.slug,excerpt:a==null?void 0:a.excerpt,publishedAt:a==null?void 0:a.publishedAt,mainImage:a==null?void 0:a.mainImage,authors:a==null?void 0:a.authors}))}),B=h==null?void 0:h.reduce((a,g)=>{let d=g==null?void 0:g.category;return a.indexOf(d)===-1&&a.push(d),a},[]),m=l==="All"?i==null?void 0:i.filter(a=>{var g;return(g=a==null?void 0:a.title)==null?void 0:g.toLowerCase().includes(w.toLowerCase())}):h.filter(a=>{var g;return(a==null?void 0:a.category)===l&&((g=a==null?void 0:a.title)==null?void 0:g.toLowerCase().includes(w.toLowerCase()))}),s=r*f,S=s-f,A=m==null?void 0:m.slice(S,s),L=a=>b(a);return n(H,{className:"py-20 bg-background",children:c(M,{maxWidth:1280,children:[n(D,{subtitle:e,title:t}),n(O,{handleSearchChange:a=>{k(a.target.value),u("All"),b(1)}}),c(x,{wrap:!0,children:[n(j,{categories:B,activeTab:l,setActiveTab:u}),(m==null?void 0:m.length)===0?n(z,{}):n(Q,{currentPosts:A,activeTab:l,blogsPerPage:f})]}),n(W,{blogsPerPage:f,totalBlogs:m==null?void 0:m.length,paginate:L,currentPage:r})]})})}function z({message:e="No post available."}){return n("div",{className:"w-full px-3 lg:w-3/4 font-medium text-lg",children:e})}function D({subtitle:e,title:t}){return c("div",{className:"w-full mb-16",children:[e?n(v,{weight:"bold",className:"text-secondary",children:e}):null,t?n(C,{fontSize:"3xl",children:t}):null]})}function O({handleSearchChange:e}){return c("div",{className:"relative mb-5 w-full lg:w-1/4",children:[n($,{type:"text","aria-label":"Search, find any question you want to ask...",className:"w-full bg-white rounded-global font-heading focus:border-gray-500 focus:outline-none",placeholder:"Search posts...",onChange:e}),n(y,{as:"button",variant:"unstyled",ariaLabel:"Search button",className:"absolute right-0 top-0 h-full px-3 bg-white rounded-global text-primary flex items-center",children:n("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:n("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})})})]})}function j({categories:e,activeTab:t,setActiveTab:i}){return n(I,{className:"w-full px-3 mb-8 bg-white lg:mb-0 lg:w-1/4",borderRadius:"global",children:e&&c(o.Fragment,{children:[n(C,{type:"h3",muted:!0,weight:"bold",className:"mb-4 text-base uppercase lg:text-base",children:"Topics"}),c("ul",{children:[(e==null?void 0:e.length)>1&&n(P,{activeTab:t,setActiveTab:i,category:"All"}),e==null?void 0:e.map((l,u)=>n(P,{activeTab:t,setActiveTab:i,category:l},u))]})]})})}function P({key:e,activeTab:t,setActiveTab:i,category:l}){return n("li",{children:n(y,{as:"button",variant:"unstyled",ariaLabel:"Show all blog posts",className:`mb-4 block ${l?"block":"hidden"} px-3 py-2 hover:bg-secondary-foreground focus:outline-none w-full text-left rounded ${t===l?"font-bold text-primary focus:outline-none bg-secondary-foreground":null}`,onClick:()=>i(l),children:l})},e)}function Q({currentPosts:e,activeTab:t,blogsPerPage:i}){var l;return e?n("div",{className:"w-full px-3 lg:w-3/4",children:t==="All"?e==null?void 0:e.map((u,r)=>n(T,{post:u},r)):(l=e==null?void 0:e.slice(0,i))==null?void 0:l.map((u,r)=>n(T,{post:u},r))}):null}function T({post:e}){var t,i,l;return e?c(x,{wrap:!0,className:"mb-8 lg:mb-6 bg-white shadow rounded-lg",children:[n("div",{className:"w-full h-full mb-4 lg:mb-0 lg:w-1/4",children:n(F,{className:"object-cover w-full h-full overflow-hidden rounded",src:`${e==null?void 0:e.mainImage}`,sizes:"100vw",width:188,height:129,alt:"blog-variantD-image-"})}),c("div",{className:"w-full px-3 py-2 lg:w-3/4",children:[(e==null?void 0:e.title)&&n(E,{"aria-label":e==null?void 0:e.title,className:"mb-1 text-2xl font-bold hover:text-secondary font-heading",href:`/${(t=e==null?void 0:e.link)!=null?t:"page-not-added"}`,children:(e==null?void 0:e.title.length)>25?((i=e==null?void 0:e.title)==null?void 0:i.substring(0,25))+"...":e==null?void 0:e.title}),c(x,{wrap:!0,align:"center",gap:1,className:"mb-2 text-sm",children:[e!=null&&e.authors?(l=e==null?void 0:e.authors)==null?void 0:l.map((u,r,{length:b})=>c(x,{children:[n(v,{className:"text-primary",children:u==null?void 0:u.name}),r+1!==b?n("span",{children:"\xA0,\xA0"}):null]},r)):null,e!=null&&e.publishedAt&&(e!=null&&e.authors)?n("span",{className:"mx-2 text-gray-500",children:"\u2022"}):null,e!=null&&e.publishedAt?n(v,{muted:!0,children:N(new Date(e==null?void 0:e.publishedAt)," dd MMM, yyyy")}):null]}),e!=null&&e.excerpt?n(v,{muted:!0,children:(e==null?void 0:e.excerpt.length)>60?(e==null?void 0:e.excerpt.substring(0,60))+"...":e==null?void 0:e.excerpt}):null]})]}):null}function W({blogsPerPage:e,totalBlogs:t,paginate:i,currentPage:l}){if(!e)return null;let u=[];for(let r=1;r<=Math.ceil(t/e);r++)u.push(r);return n("nav",{className:"mt-4","aria-label":"Pagination",children:n("ul",{className:"flex space-x-2 justify-end mr-5",children:u.map(r=>n(y,{variant:"unstyled",as:"button",ariaLabel:`Page ${r}`,className:`${l===r?"bg-secondary-foreground text-gray-500":"bg-white hover:bg-secondary-foreground hover:text-gray-500"} text-primary font-medium py-2 px-4 border border-primary rounded focus:outline-none`,onClick:()=>i(r),children:r},r))})})}export{R as a};
File without changes