@stackshift-ui/blog 6.0.15-beta.2 → 6.1.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/blog_b.tsx CHANGED
@@ -1,10 +1,12 @@
1
1
  import { Button } from "@stackshift-ui/button";
2
+ import { Card, CardContent } from "@stackshift-ui/card";
2
3
  import { Container } from "@stackshift-ui/container";
3
4
  import { Flex } from "@stackshift-ui/flex";
4
5
  import { Heading } from "@stackshift-ui/heading";
5
6
  import { Image } from "@stackshift-ui/image";
6
7
  import { Link } from "@stackshift-ui/link";
7
8
  import { Section } from "@stackshift-ui/section";
9
+ import { buildSanityLink } from "@stackshift-ui/system";
8
10
  import { Text } from "@stackshift-ui/text";
9
11
  import { format } from "date-fns";
10
12
  import { BlogProps } from ".";
@@ -50,12 +52,12 @@ function BlogPosts({
50
52
  }) {
51
53
  return (
52
54
  <Flex wrap justify="center" className="mb-16" gap={4}>
53
- <div className="w-full lg:w-[45%]">
55
+ <div className="w-full lg:w-[40%]">
54
56
  {posts
55
57
  ?.slice(count, count + 1)
56
58
  .map((post, key) => <BlogItem size="lg" post={post} key={key} />)}
57
59
  </div>
58
- <Flex wrap className="w-full lg:w-[45%]" gap={4}>
60
+ <Flex wrap className="w-full lg:w-[50%]" gap={4}>
59
61
  {posts?.slice(count + 1, blogsPerPage).map((post, key) => (
60
62
  <div className="w-full lg:basis-[45%]" key={key}>
61
63
  <BlogItem post={post} size="sm" key={key} />
@@ -70,56 +72,50 @@ function BlogItem({ post, size, key }: { post: BlogPost; size?: string; key: num
70
72
  const breakpoints = useMediaQuery("1024");
71
73
 
72
74
  return (
73
- <div className="overflow-hidden rounded-md shadow">
75
+ <Card className="overflow-hidden rounded-md shadow">
74
76
  {post?.mainImage ? (
75
77
  <ImageContainer post={post} size={size} breakpoints={breakpoints} key={key} />
76
78
  ) : null}
77
- <div className="p-6 bg-white flex flex-col justify-between" style={{ height: "295px" }}>
78
- <div>
79
- <Flex align="center">
80
- {post?.publishedAt ? (
81
- <Text muted className="text-sm">
82
- {format(new Date(post.publishedAt), " dd MMM, yyyy")}
83
- </Text>
84
- ) : null}
85
- {post?.authors && (
86
- <>
87
- <span className="mx-2 w-1 h-1 bg-gray-500 rounded-full"></span>
88
- <div className="flex mt-auto text-sm text-gray-500">
89
- {post?.authors?.map((author, index, { length }) => (
90
- <>
91
- <Text className="italic" fontSize="sm">
92
- {author?.name}
93
- </Text>
94
- {index + 1 !== length ? <span>&nbsp;,&nbsp;</span> : null}
95
- </>
96
- ))}
97
- </div>
98
- </>
99
- )}
100
- </Flex>
101
-
79
+ <Flex direction="col" className="bg-white justify-between" style={{ height: "295px" }}>
80
+ <CardContent className="p-4">
81
+ {post?.publishedAt ? (
82
+ <Text muted className="text-sm">
83
+ {format(new Date(post.publishedAt), " dd MMM, yyyy")}
84
+ </Text>
85
+ ) : null}
102
86
  {post?.title ? (
103
- <Heading type="h4" className="my-2">
104
- {post.title.length > 25 ? `${post.title.substring(0, 25)}...` : post.title}
87
+ <Heading type="h4" className="line-clamp-3 !text-2xl">
88
+ {post.title}
105
89
  </Heading>
106
90
  ) : null}
91
+ {post?.authors && (
92
+ <Flex className="mt-auto text-sm text-gray-500">
93
+ {post?.authors?.map((author, index, { length }) => (
94
+ <>
95
+ <Text className="italic" fontSize="sm">
96
+ {author?.name}
97
+ </Text>
98
+ {index + 1 !== length ? <span>&nbsp;,&nbsp;</span> : null}
99
+ </>
100
+ ))}
101
+ </Flex>
102
+ )}
107
103
  {post?.excerpt ? (
108
- <Text muted className="mb-6 text-justify">
109
- {post.excerpt.length > 41 ? `${post.excerpt.substring(0, 41)}...` : post.excerpt}
104
+ <Text muted className="my-2 text-justify line-clamp-3">
105
+ {post.excerpt}
110
106
  </Text>
111
107
  ) : null}
112
- </div>
108
+ </CardContent>
113
109
  {post?.link ? (
114
110
  <Link
115
111
  aria-label="View Blog Post"
116
- className="font-bold text-primary hover:text-secondary"
112
+ className="font-bold text-primary hover:text-secondary px-4 pb-4"
117
113
  href={`/${post?.link}`}>
118
114
  View Blog Post
119
115
  </Link>
120
116
  ) : null}
121
- </div>
122
- </div>
117
+ </Flex>
118
+ </Card>
123
119
  );
124
120
  }
125
121
 
@@ -134,42 +130,46 @@ function ImageContainer({
134
130
  breakpoints: boolean;
135
131
  key: number;
136
132
  }) {
137
- return (
138
- <>
139
- {breakpoints ? (
140
- <Image
141
- className="object-cover w-full overflow-hidden"
142
- src={`${post.mainImage}`}
143
- sizes="100vw"
144
- style={{ width: "100%", height: "auto", objectFit: "cover" }}
145
- width={271}
146
- height={248}
147
- alt={post?.mainImage ?? `blog-variantB-image-${key}`}
148
- />
149
- ) : (
150
- <div className={`${size === "lg" ? "h-[44.5rem]" : "h-[12.5rem]"}`}>
151
- <Image
152
- className="object-cover w-full overflow-hidden rounded-t-md"
153
- src={`${post.mainImage}`}
154
- sizes="100vw"
155
- style={{ width: "100%", height: "100%", objectFit: "cover" }}
156
- width={271}
157
- height={248}
158
- alt={`blog-variantB-image-${post.title}`}
159
- />
160
- </div>
161
- )}
162
- </>
133
+ return breakpoints ? (
134
+ <Image
135
+ className="object-cover w-full overflow-hidden"
136
+ src={`${post.mainImage}`}
137
+ sizes="100vw"
138
+ style={{ width: "100%", height: "auto", objectFit: "cover" }}
139
+ width={271}
140
+ height={248}
141
+ alt={post?.mainImage ?? `blog-variantB-image-${key}`}
142
+ />
143
+ ) : (
144
+ <div className={`${size === "lg" ? "h-[44.5rem]" : "h-[12.5rem]"}`}>
145
+ <Image
146
+ className="object-cover w-full overflow-hidden rounded-t-md"
147
+ src={`${post.mainImage}`}
148
+ sizes="100vw"
149
+ style={{ width: "100%", height: "100%", objectFit: "cover" }}
150
+ width={271}
151
+ height={248}
152
+ alt={`blog-variantB-image-${post.title}`}
153
+ />
154
+ </div>
163
155
  );
164
156
  }
165
157
 
166
158
  function PrimaryButton({ primaryButton }: { primaryButton?: LabeledRoute }) {
167
159
  if (!primaryButton?.label) return null;
168
160
 
161
+ const link = buildSanityLink(primaryButton);
162
+
169
163
  return (
170
164
  <div className="text-center">
171
- <Button as="link" link={primaryButton} ariaLabel={primaryButton?.label}>
172
- {primaryButton?.label}
165
+ <Button aria-label={primaryButton?.label} asChild>
166
+ <Link
167
+ href={link.href}
168
+ target={link.target}
169
+ rel={link.rel}
170
+ aria-label={primaryButton?.label}>
171
+ {primaryButton?.label}
172
+ </Link>
173
173
  </Button>
174
174
  </div>
175
175
  );
package/src/blog_c.tsx CHANGED
@@ -1,14 +1,15 @@
1
1
  import { Badge } from "@stackshift-ui/badge";
2
2
  import { Button } from "@stackshift-ui/button";
3
+ import { Card, CardContent } from "@stackshift-ui/card";
3
4
  import { Container } from "@stackshift-ui/container";
4
5
  import { Flex } from "@stackshift-ui/flex";
5
6
  import { Heading } from "@stackshift-ui/heading";
6
7
  import { Image } from "@stackshift-ui/image";
7
8
  import { Link } from "@stackshift-ui/link";
8
9
  import { Section } from "@stackshift-ui/section";
10
+ import { buildSanityLink } from "@stackshift-ui/system";
9
11
  import { Text } from "@stackshift-ui/text";
10
12
  import { format } from "date-fns";
11
- import React from "react";
12
13
  import { BlogProps } from ".";
13
14
  import { useMediaQuery } from "./hooks/useMediaQuery";
14
15
  import { BlogPost, LabeledRoute } from "./types";
@@ -64,7 +65,8 @@ function BlogItem({ post, className, key }: { key: number; post: BlogPost; class
64
65
  const maxExcerptLength = breakpoints ? 70 : 200;
65
66
 
66
67
  return (
67
- <Flex wrap className={`bg-white overflow-hidden rounded-lg shadow w-full ${className}`}>
68
+ <Card
69
+ className={`flex flex-wrap bg-white overflow-hidden rounded-lg shadow w-full ${className}`}>
68
70
  {post?.mainImage && (
69
71
  <Image
70
72
  className="object-cover w-full h-auto rounded-l lg:w-1/2"
@@ -75,8 +77,8 @@ function BlogItem({ post, className, key }: { key: number; post: BlogPost; class
75
77
  alt={post?.alt ?? `blog-variantC-image-${key}`}
76
78
  />
77
79
  )}
78
- <div className="w-full px-6 py-6 rounded-r lg:w-1/2 lg:pt-10">
79
- <div className="flex flex-col sm:flex-row sm:items-center gap-3">
80
+ <CardContent className="w-full px-6 py-6 rounded-r lg:w-1/2 lg:pt-10">
81
+ <Flex className="flex-col sm:flex-row sm:items-center gap-3">
80
82
  {post?.categories &&
81
83
  post?.categories?.map((category, index) => (
82
84
  <Badge className="bg-secondary rounded-global w-fit" key={index}>
@@ -88,7 +90,7 @@ function BlogItem({ post, className, key }: { key: number; post: BlogPost; class
88
90
  {format(new Date(post?.publishedAt), " dd MMM, yyyy")}
89
91
  </Text>
90
92
  )}
91
- </div>
93
+ </Flex>
92
94
 
93
95
  {post?.title && (
94
96
  <Heading className="my-4 text-xl lg:text-3xl">
@@ -96,7 +98,7 @@ function BlogItem({ post, className, key }: { key: number; post: BlogPost; class
96
98
  </Heading>
97
99
  )}
98
100
  {post?.authors && (
99
- <div className="flex mb-10 flex-wrap">
101
+ <Flex wrap className="mb-10">
100
102
  <span className="italic text-primary">By&nbsp;</span>
101
103
  {post?.authors?.map((author, index, { length }) => (
102
104
  <>
@@ -104,7 +106,7 @@ function BlogItem({ post, className, key }: { key: number; post: BlogPost; class
104
106
  {index + 1 !== length ? <span>&nbsp;,&nbsp;</span> : null}
105
107
  </>
106
108
  ))}
107
- </div>
109
+ </Flex>
108
110
  )}
109
111
  {post?.excerpt && (
110
112
  <Text muted className="mb-6 leading-loose lg:text-justify">
@@ -116,27 +118,33 @@ function BlogItem({ post, className, key }: { key: number; post: BlogPost; class
116
118
  {post?.link && (
117
119
  <Link
118
120
  aria-label="View Blog Post"
119
- className="font-bold text-primary hover:text-primary-foreground"
121
+ className="font-bold text-primary hover:text-secondary"
120
122
  href={`/${post?.link}`}>
121
123
  View Blog Post
122
124
  </Link>
123
125
  )}
124
- </div>
125
- </Flex>
126
+ </CardContent>
127
+ </Card>
126
128
  );
127
129
  }
128
130
 
129
131
  function PrimaryButton({ primaryButton }: { primaryButton?: LabeledRoute }) {
130
132
  if (!primaryButton?.label) return null;
131
133
 
134
+ const link = buildSanityLink(primaryButton);
135
+
132
136
  return (
133
- <Button
134
- as="link"
135
- link={primaryButton}
136
- ariaLabel={primaryButton?.label}
137
- className="inline-flex flex-wrap text-center bg-primary text-sm sm:text-base px-6 py-3 rounded-global">
138
- {primaryButton?.label}
139
- </Button>
137
+ <div className="text-center">
138
+ <Button aria-label={primaryButton?.label} asChild>
139
+ <Link
140
+ href={link.href}
141
+ target={link.target}
142
+ rel={link.rel}
143
+ aria-label={primaryButton?.label}>
144
+ {primaryButton?.label}
145
+ </Link>
146
+ </Button>
147
+ </div>
140
148
  );
141
149
  }
142
150
 
package/src/blog_d.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Button } from "@stackshift-ui/button";
2
- import { Card } from "@stackshift-ui/card";
2
+ import { Card, CardContent } from "@stackshift-ui/card";
3
3
  import { Container } from "@stackshift-ui/container";
4
4
  import { Flex } from "@stackshift-ui/flex";
5
5
  import { Heading } from "@stackshift-ui/heading";
@@ -114,7 +114,7 @@ export default function Blog_D({ subtitle, title, posts }: BlogProps) {
114
114
  }
115
115
 
116
116
  function NoPostsMessage({ message = "No post available." }) {
117
- return <div className="w-full px-3 lg:w-3/4 font-medium text-lg">{message}</div>;
117
+ return <Text className="w-full px-3 lg:w-3/4 font-medium text-lg">{message}</Text>;
118
118
  }
119
119
 
120
120
  function SubtitleAndTitleText({ subtitle, title }: { subtitle?: string; title?: string }) {
@@ -145,10 +145,9 @@ function SearchInput({
145
145
  onChange={handleSearchChange}
146
146
  />
147
147
  <Button
148
- as="button"
149
148
  variant="unstyled"
150
- ariaLabel="Search button"
151
- className="absolute right-0 top-0 h-full px-3 bg-white border-r rounded-global text-primary flex items-center">
149
+ aria-label="Search button"
150
+ className="absolute right-0 top-0 h-full px-3 border-r rounded-global text-primary flex items-center">
152
151
  <svg
153
152
  className="w-6 h-6"
154
153
  fill="none"
@@ -177,7 +176,7 @@ function CategoryTab({
177
176
  setActiveTab: (category: string) => void;
178
177
  }) {
179
178
  return (
180
- <Card className="w-full px-3 mb-8 bg-white lg:mb-0 lg:w-1/4" borderRadius="md">
179
+ <Card className="w-full p-3 mb-8 bg-white lg:mb-0 lg:w-1/4 rounded-md">
181
180
  {categories && (
182
181
  <React.Fragment>
183
182
  <Heading
@@ -220,9 +219,8 @@ function CategoryItem({
220
219
  return (
221
220
  <li key={key}>
222
221
  <Button
223
- as="button"
224
222
  variant="unstyled"
225
- ariaLabel="Show all blog posts"
223
+ aria-label="Show all blog posts"
226
224
  className={`mb-4 block ${
227
225
  !category ? "hidden" : "block"
228
226
  } px-3 py-2 hover:bg-secondary-foreground focus:outline-none w-full text-left rounded ${
@@ -263,10 +261,10 @@ function PostItem({ post }: { post?: BlogPost }) {
263
261
  if (!post) return null;
264
262
 
265
263
  return (
266
- <Flex wrap className="mb-8 lg:mb-6 bg-white shadow rounded-lg">
264
+ <Card className="flex flex-wrap mb-8 lg:mb-6 bg-white shadow rounded-lg">
267
265
  <div className="w-full h-full mb-4 lg:mb-0 lg:w-1/4">
268
266
  <Image
269
- className="object-cover w-full h-full overflow-hidden rounded"
267
+ className="object-cover w-full h-full overflow-hidden rounded-l"
270
268
  src={`${post?.mainImage}`}
271
269
  sizes="100vw"
272
270
  width={188}
@@ -274,38 +272,35 @@ function PostItem({ post }: { post?: BlogPost }) {
274
272
  alt={post?.alt ?? `blog-variantD-image-${post?.title}`}
275
273
  />
276
274
  </div>
277
- <div className="w-full px-3 py-2 lg:w-3/4">
275
+ <CardContent className="w-full px-3 py-2 lg:w-3/4">
276
+ {post?.publishedAt ? (
277
+ <Text muted>{format(new Date(post?.publishedAt), " dd MMM, yyyy")}</Text>
278
+ ) : null}
278
279
  {post?.title && (
279
280
  <Link
280
281
  aria-label={post?.title}
281
- className="mb-1 text-2xl font-bold hover:text-secondary font-heading"
282
+ className="mb-1 text-2xl font-bold hover:text-secondary font-heading line-clamp-3 sm:line-clamp-1"
282
283
  href={`/${post?.link ?? "page-not-added"}`}>
283
- {post?.title.length > 25 ? post?.title?.substring(0, 25) + "..." : post?.title}
284
+ {post?.title}
284
285
  </Link>
285
286
  )}
286
- <Flex wrap align="center" gap={1} className="mb-2 text-sm">
287
- {post?.authors
288
- ? post?.authors?.map((author, index, { length }) => (
289
- <Flex key={index}>
290
- <Text className="text-primary">{author?.name}</Text>
291
- {index + 1 !== length ? <span>&nbsp;,&nbsp;</span> : null}
292
- </Flex>
293
- ))
294
- : null}
295
- {post?.publishedAt && post?.authors ? (
296
- <span className="mx-2 text-gray-500">•</span>
297
- ) : null}
298
- {post?.publishedAt ? (
299
- <Text muted>{format(new Date(post?.publishedAt), " dd MMM, yyyy")}</Text>
300
- ) : null}
301
- </Flex>
287
+ {post?.authors ? (
288
+ <Flex align="center">
289
+ {post?.authors?.map((author, index, { length }) => (
290
+ <Text className="text-primary">
291
+ {author?.name}
292
+ {index + 1 !== length ? <span>&nbsp;,&nbsp;</span> : null}
293
+ </Text>
294
+ ))}
295
+ </Flex>
296
+ ) : null}
302
297
  {post?.excerpt ? (
303
- <Text muted>
304
- {post?.excerpt.length > 60 ? post?.excerpt.substring(0, 60) + "..." : post?.excerpt}
298
+ <Text muted className="line-clamp-6 sm:line-clamp-3">
299
+ {post?.excerpt}
305
300
  </Text>
306
301
  ) : null}
307
- </div>
308
- </Flex>
302
+ </CardContent>
303
+ </Card>
309
304
  );
310
305
  }
311
306
 
@@ -330,8 +325,7 @@ function Pagination({ blogsPerPage, totalBlogs, paginate, currentPage }: Paginat
330
325
  {pageNumber.map(number => (
331
326
  <Button
332
327
  variant="unstyled"
333
- as="button"
334
- ariaLabel={`Page ${number}`}
328
+ aria-label={`Page ${number}`}
335
329
  key={number}
336
330
  className={`${
337
331
  currentPage === number
@@ -1 +0,0 @@
1
- import{a as P}from"./chunk-PC6NMI3O.mjs";import{Button as w}from"@stackshift-ui/button";import{Card as I}from"@stackshift-ui/card";import{Container as M}from"@stackshift-ui/container";import{Flex as v}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 y}from"@stackshift-ui/text";import f from"react";import{jsx as n,jsxs as c}from"react/jsx-runtime";function R({subtitle:e,title:t,posts:i}){let[l,u]=f.useState("All"),[r,d]=f.useState(1),[h,k]=f.useState(""),o=6;f.useEffect(()=>{d(1)},[l]);let x=(i!=null?i:[]).flatMap(a=>{var g;return((g=a==null?void 0:a.categories)!=null?g:[]).map(b=>({category:b==null?void 0:b.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=x==null?void 0:x.reduce((a,g)=>{let b=g==null?void 0:g.category;return a.indexOf(b)===-1&&a.push(b),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(h.toLowerCase())}):x.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(h.toLowerCase()))}),N=r*o,S=N-o,A=m==null?void 0:m.slice(S,N),L=a=>d(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"),d(1)}}),c(v,{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:o})]}),n(W,{blogsPerPage:o,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(y,{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 border rounded-global font-heading focus:border-gray-500 focus:outline-none",placeholder:"Search posts...",onChange:e}),n(w,{as:"button",variant:"unstyled",ariaLabel:"Search button",className:"absolute right-0 top-0 h-full px-3 bg-white border-r 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:"md",children:e&&c(f.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(T,{activeTab:t,setActiveTab:i,category:"All"}),e==null?void 0:e.map((l,u)=>n(T,{activeTab:t,setActiveTab:i,category:l},u))]})]})})}function T({key:e,activeTab:t,setActiveTab:i,category:l}){return n("li",{children:n(w,{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(s,{post:u},r)):(l=e==null?void 0:e.slice(0,i))==null?void 0:l.map((u,r)=>n(s,{post:u},r))}):null}function s({post:e}){var t,i,l,u;return e?c(v,{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:(t=e==null?void 0:e.alt)!=null?t:`blog-variantD-image-${e==null?void 0:e.title}`})}),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:`/${(i=e==null?void 0:e.link)!=null?i:"page-not-added"}`,children:(e==null?void 0:e.title.length)>25?((l=e==null?void 0:e.title)==null?void 0:l.substring(0,25))+"...":e==null?void 0:e.title}),c(v,{wrap:!0,align:"center",gap:1,className:"mb-2 text-sm",children:[e!=null&&e.authors?(u=e==null?void 0:e.authors)==null?void 0:u.map((r,d,{length:h})=>c(v,{children:[n(y,{className:"text-primary",children:r==null?void 0:r.name}),d+1!==h?n("span",{children:"\xA0,\xA0"}):null]},d)):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(y,{muted:!0,children:P(new Date(e==null?void 0:e.publishedAt)," dd MMM, yyyy")}):null]}),e!=null&&e.excerpt?n(y,{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(w,{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-global focus:outline-none`,onClick:()=>i(r),children:r},r))})})}export{R as a};
@@ -1 +0,0 @@
1
- import{a as b}from"./chunk-TMLYY2AQ.mjs";import{a as s}from"./chunk-PC6NMI3O.mjs";import{Button as h}from"@stackshift-ui/button";import{Container as w}from"@stackshift-ui/container";import{Flex as c}from"@stackshift-ui/flex";import{Heading as o}from"@stackshift-ui/heading";import{Image as u}from"@stackshift-ui/image";import{Link as N}from"@stackshift-ui/link";import{Section as P}from"@stackshift-ui/section";import{Text as g}from"@stackshift-ui/text";import{Fragment as d,jsx as l,jsxs as r}from"react/jsx-runtime";function k({subtitle:e,title:i,posts:m,primaryButton:n}){return l(P,{className:"py-20 bg-background",children:r(w,{maxWidth:1280,children:[l(y,{subtitle:e,title:i}),l(z,{posts:m,count:0,blogsPerPage:5}),l(I,{primaryButton:n})]})})}function y({subtitle:e,title:i}){return r("div",{className:"w-full mb-16 text-center",children:[e?l(g,{weight:"bold",className:"text-secondary",children:e}):null,i?l(o,{fontSize:"3xl",children:i}):null]})}function z({posts:e,count:i,blogsPerPage:m}){return r(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,a)=>l(f,{size:"lg",post:n},a))}),l(c,{wrap:!0,className:"w-full lg:w-[45%]",gap:4,children:e==null?void 0:e.slice(i+1,m).map((n,a)=>l("div",{className:"w-full lg:basis-[45%]",children:l(f,{post:n,size:"sm"},a)},a))})]})}function f({post:e,size:i,key:m}){var a;let n=b("1024");return r("div",{className:"overflow-hidden rounded-md shadow",children:[e!=null&&e.mainImage?l($,{post:e,size:i,breakpoints:n},m):null,r("div",{className:"p-6 bg-white flex flex-col justify-between",style:{height:"295px"},children:[r("div",{children:[r(c,{align:"center",children:[e!=null&&e.publishedAt?l(g,{muted:!0,className:"text-sm",children:s(new Date(e.publishedAt)," dd MMM, yyyy")}):null,(e==null?void 0:e.authors)&&r(d,{children:[l("span",{className:"mx-2 w-1 h-1 bg-gray-500 rounded-full"}),l("div",{className:"flex mt-auto text-sm text-gray-500",children:(a=e==null?void 0:e.authors)==null?void 0:a.map((t,v,{length:x})=>r(d,{children:[l(g,{className:"italic",fontSize:"sm",children:t==null?void 0:t.name}),v+1!==x?l("span",{children:"\xA0,\xA0"}):null]}))})]})]}),e!=null&&e.title?l(o,{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(N,{"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 $({post:e,size:i,breakpoints:m,key:n}){var a;return l(d,{children:m?l(u,{className:"object-cover w-full overflow-hidden",src:`${e.mainImage}`,sizes:"100vw",style:{width:"100%",height:"auto",objectFit:"cover"},width:271,height:248,alt:(a=e==null?void 0:e.mainImage)!=null?a:`blog-variantB-image-${n}`}):l("div",{className:`${i==="lg"?"h-[44.5rem]":"h-[12.5rem]"}`,children:l(u,{className:"object-cover w-full overflow-hidden rounded-t-md",src:`${e.mainImage}`,sizes:"100vw",style:{width:"100%",height:"100%",objectFit:"cover"},width:271,height:248,alt:`blog-variantB-image-${e.title}`})})})}function I({primaryButton:e}){return e!=null&&e.label?l("div",{className:"text-center",children:l(h,{as:"link",link:e,ariaLabel:e==null?void 0:e.label,children:e==null?void 0:e.label})}):null}export{k as a};
@@ -1 +0,0 @@
1
- import{a as P}from"./chunk-TMLYY2AQ.mjs";import{a as v}from"./chunk-PC6NMI3O.mjs";import{Badge as L}from"@stackshift-ui/badge";import{Button as y}from"@stackshift-ui/button";import{Container as $}from"@stackshift-ui/container";import{Flex as h}from"@stackshift-ui/flex";import{Heading as k}from"@stackshift-ui/heading";import{Image as C}from"@stackshift-ui/image";import{Link as I}from"@stackshift-ui/link";import{Section as M}from"@stackshift-ui/section";import{Text as g}from"@stackshift-ui/text";import{Fragment as R,jsx as l,jsxs as i}from"react/jsx-runtime";function S({subtitle:e,title:a,posts:m,primaryButton:d}){return l(M,{className:"py-20 bg-background",children:i($,{maxWidth:1280,children:[i(h,{align:"center",justify:"between",className:"flex-col mb-16 md:flex-row",gap:5,children:[l(A,{subtitle:e,title:a}),l(H,{primaryButton:d})]}),l(B,{posts:m,blogsPerPage:3})]})})}function A({subtitle:e,title:a}){return i("div",{className:"flex flex-col gap-3 text-center md:text-left",children:[e?l(g,{weight:"bold",className:"text-primary",children:e}):null,a?l(k,{fontSize:"3xl",children:a}):null]})}function B({posts:e,blogsPerPage:a}){var m;return e?l("div",{children:(m=e==null?void 0:e.slice(0,a))==null?void 0:m.map((d,r)=>l("div",{className:"flex flex-wrap mb-8 overflow-hidden rounded-md shadow",children:l(F,{post:d,className:`${r%2===0?"flex-row":"flex-row-reverse"}`},r)},r))}):null}function F({post:e,className:a,key:m}){var x,c,b,u,w,t,N;let r=P("1100")?70:200;return i(h,{wrap:!0,className:`bg-white overflow-hidden rounded-lg shadow w-full ${a}`,children:[(e==null?void 0:e.mainImage)&&l(C,{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:(x=e==null?void 0:e.alt)!=null?x:`blog-variantC-image-${m}`}),i("div",{className:"w-full px-6 py-6 rounded-r lg:w-1/2 lg:pt-10",children:[i("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3",children:[(e==null?void 0:e.categories)&&((c=e==null?void 0:e.categories)==null?void 0:c.map((n,f)=>l(L,{className:"bg-secondary rounded-global w-fit",children:n==null?void 0:n.title},f))),(e==null?void 0:e.publishedAt)&&l(g,{muted:!0,className:"m-1",children:v(new Date(e==null?void 0:e.publishedAt)," dd MMM, yyyy")})]}),(e==null?void 0:e.title)&&l(k,{className:"my-4 text-xl lg:text-3xl",children:((b=e==null?void 0:e.title)==null?void 0:b.length)>40?((u=e==null?void 0:e.title)==null?void 0:u.substring(0,40))+"...":e==null?void 0:e.title}),(e==null?void 0:e.authors)&&i("div",{className:"flex mb-10 flex-wrap",children:[l("span",{className:"italic text-primary",children:"By\xA0"}),(w=e==null?void 0:e.authors)==null?void 0:w.map((n,f,{length:T})=>i(R,{children:[l(g,{className:"italic text-primary",children:n==null?void 0:n.name}),f+1!==T?l("span",{children:"\xA0,\xA0"}):null]}))]}),(e==null?void 0:e.excerpt)&&l(g,{muted:!0,className:"mb-6 leading-loose lg:text-justify",children:((t=e==null?void 0:e.excerpt)==null?void 0:t.length)>r?((N=e==null?void 0:e.excerpt)==null?void 0:N.substring(0,r))+"...":e==null?void 0:e.excerpt}),(e==null?void 0:e.link)&&l(I,{"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 H({primaryButton:e}){return e!=null&&e.label?l(y,{as:"link",link:e,ariaLabel:e==null?void 0:e.label,className:"inline-flex flex-wrap text-center bg-primary text-sm sm:text-base px-6 py-3 rounded-global",children:e==null?void 0:e.label}):null}export{S as a};
@@ -1 +0,0 @@
1
- import{lazy as i}from"react";import{jsx as b}from"react/jsx-runtime";var g={variant_a:i(()=>import("./blog_a.mjs")),variant_b:i(()=>import("./blog_b.mjs")),variant_c:i(()=>import("./blog_c.mjs")),variant_d:i(()=>import("./blog_d.mjs"))},y="Blog",B=({data:o})=>{var s,t,e,p,l,u,m,v,c;let n=o==null?void 0:o.variant,r=n&&g[n],f={subtitle:(t=(s=o==null?void 0:o.variants)==null?void 0:s.subtitle)!=null?t:void 0,title:(p=(e=o==null?void 0:o.variants)==null?void 0:e.title)!=null?p:void 0,posts:(m=((l=o==null?void 0:o.variants)==null?void 0:l.posts)||((u=o==null?void 0:o.variants)==null?void 0:u.blogPosts))!=null?m:void 0,primaryButton:(c=(v=o==null?void 0:o.variants)==null?void 0:v.primaryButton)!=null?c:void 0};return r?b(r,{...f}):null};B.displayName=y;export{B as a};
@@ -1 +0,0 @@
1
- import{a as b}from"./chunk-PC6NMI3O.mjs";import{Button as w}from"@stackshift-ui/button";import{Container as N}from"@stackshift-ui/container";import{Flex as u}from"@stackshift-ui/flex";import{Heading as h}from"@stackshift-ui/heading";import{Image as k}from"@stackshift-ui/image";import{Link as P}from"@stackshift-ui/link";import{Section as y}from"@stackshift-ui/section";import{Text as v}from"@stackshift-ui/text";import{Fragment as t,jsx as l,jsxs as m}from"react/jsx-runtime";function A({subtitle:e,title:d,posts:a,primaryButton:c}){return l(y,{className:"py-20 bg-background",children:m(N,{maxWidth:1280,children:[l(F,{subtitle:e,title:d}),l(L,{posts:a}),l(S,{primaryButton:c})]})})}function F({subtitle:e,title:d}){return m("div",{className:"mb-16 text-center",children:[e?l(v,{weight:"bold",className:"text-secondary",children:e}):null,d?l(h,{fontSize:"3xl",children:d}):null]})}function L({posts:e}){var c,x,f,n;if(!e)return null;let d=6,a=0;return m(u,{gap:4,className:"flex-col lg:flex-row",children:[m("div",{className:"w-full space-y-5 lg:w-1/2",children:[(c=e==null?void 0:e.slice(a,a+1))==null?void 0:c.map((i,r)=>l(g,{post:i},r)),l(u,{gap:4,className:"flex-col lg:flex-row",children:(x=e==null?void 0:e.slice(a+1,a+3))==null?void 0:x.map((i,r)=>l(g,{post:i},r))})]}),m("div",{className:"w-full space-y-5 lg:w-1/2",children:[l(u,{gap:4,className:"flex-col lg:flex-row",children:(f=e==null?void 0:e.slice(a+3,a+5))==null?void 0:f.map((i,r)=>l(g,{post:i},r))}),(n=e==null?void 0:e.slice(a+5,d))==null?void 0:n.map((i,r)=>l(g,{post:i},r))]})]})}function g({post:e,key:d}){var a,c,x,f;return m("div",{className:"relative w-full h-64 rounded",children:[e!=null&&e.mainImage?l(k,{className:"relative object-cover w-full h-full overflow-hidden rounded-md",src:`${e==null?void 0:e.mainImage}`,alt:(a=e==null?void 0:e.alt)!=null?a:`blog-variantA-image-${d}`,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-md opacity-75"}),m("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:(c=e==null?void 0:e.categories)==null?void 0:c.map((n,i)=>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},i))}):null,m(u,{align:"center",className:"mt-auto",children:[l("span",{className:"mt-auto text-sm text-gray-500",children:e!=null&&e.publishedAt?b(new Date(e==null?void 0:e.publishedAt),"dd MMM, yyyy"):""}),(e==null?void 0:e.authors)&&m(t,{children:[l("span",{className:"mx-2 w-1 h-1 bg-gray-500 rounded-full"}),l("div",{className:"flex mt-auto text-sm text-gray-500",children:(x=e==null?void 0:e.authors)==null?void 0:x.map((n,i,{length:r})=>m(t,{children:[l(v,{className:"italic",fontSize:"sm",children:n==null?void 0:n.name}),i+1!==r?l("span",{children:"\xA0,\xA0"}):null]}))})]})]}),e!=null&&e.title?l(P,{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:((f=e==null?void 0:e.title)==null?void 0:f.length)>40?(e==null?void 0:e.title.substring(0,40))+"...":e==null?void 0:e.title}):null]})]})}function S({primaryButton:e}){return e!=null&&e.label?l("div",{className:"mt-10 text-center",children:l(w,{as:"link",link:e,ariaLabel:e==null?void 0:e.label,children:e==null?void 0:e.label})}):null}export{A as a};