@windstream/react-shared-components 0.1.60 → 0.1.62
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/contentful/index.d.ts +17 -1
- package/dist/contentful/index.esm.js +2 -2
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +2 -2
- package/dist/contentful/index.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/pagination/index.tsx +5 -14
- package/src/contentful/blocks/blogs-grid-base/index.tsx +24 -20
- package/src/contentful/blocks/blogs-grid-base/types.ts +5 -0
- package/src/contentful/blocks/cards/blog-card/index.tsx +21 -9
- package/src/contentful/blocks/cards/blog-card/types.ts +16 -0
package/dist/core.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAtt
|
|
|
63
63
|
size?: "slim" | "medium" | "large" | undefined;
|
|
64
64
|
label?: string | undefined;
|
|
65
65
|
errorText?: string | undefined;
|
|
66
|
-
prefixIconName?: "
|
|
66
|
+
prefixIconName?: "location_on" | "search" | undefined;
|
|
67
67
|
prefixIconSize?: 20 | 24 | 40 | 48 | undefined;
|
|
68
68
|
prefixIconFill?: boolean | undefined;
|
|
69
69
|
suffixIconFill?: boolean | undefined;
|
package/package.json
CHANGED
|
@@ -78,23 +78,14 @@ function buildPageItems(current: number, total: number): (number | "...")[] {
|
|
|
78
78
|
if (total <= 7) {
|
|
79
79
|
return Array.from({ length: total }, (_, i) => i + 1);
|
|
80
80
|
}
|
|
81
|
-
const items: (number | "...")[] = [];
|
|
82
|
-
items.push(1);
|
|
83
81
|
|
|
84
|
-
if (current
|
|
85
|
-
|
|
82
|
+
if (current <= 4) {
|
|
83
|
+
return [1, 2, 3, 4, 5, "...", total];
|
|
86
84
|
}
|
|
87
|
-
const rangeStart = Math.max(2, current - 1);
|
|
88
|
-
const rangeEnd = Math.min(total - 1, current + 1);
|
|
89
85
|
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
if (current >= total - 3) {
|
|
87
|
+
return [1, "...", total - 4, total - 3, total - 2, total - 1, total];
|
|
92
88
|
}
|
|
93
89
|
|
|
94
|
-
|
|
95
|
-
items.push("...");
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
items.push(total);
|
|
99
|
-
return items;
|
|
90
|
+
return [1, "...", current - 1, current, current + 1, "...", total];
|
|
100
91
|
}
|
|
@@ -14,6 +14,7 @@ export function BlogGridBase({
|
|
|
14
14
|
categoryOptions,
|
|
15
15
|
onCategoryChange,
|
|
16
16
|
onPageChange,
|
|
17
|
+
imageComponent,
|
|
17
18
|
}: BlogGridBaseProps) {
|
|
18
19
|
function handleCategoryChange(value: unknown) {
|
|
19
20
|
if (!value || Array.isArray(value)) return;
|
|
@@ -37,28 +38,30 @@ export function BlogGridBase({
|
|
|
37
38
|
recent articles
|
|
38
39
|
</Text>
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<Text
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<strong className="block text-nowrap font-bold text-text-info">
|
|
47
|
-
<Text as="span" className="md:hidden">
|
|
48
|
-
showing{" "}
|
|
41
|
+
{categoryOptions.length > 0 && (
|
|
42
|
+
<div className="flex w-full flex-col-reverse gap-3 md:w-auto md:flex-row md:items-center md:gap-6">
|
|
43
|
+
{/* Showing count */}
|
|
44
|
+
<Text className="whitespace-nowrap text-center text-label3 font-bold text-text-info md:text-right md:text-label2">
|
|
45
|
+
<Text as="span" className="hidden md:block">
|
|
46
|
+
showing
|
|
49
47
|
</Text>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
<strong className="block text-nowrap font-bold text-text-info">
|
|
49
|
+
<Text as="span" className="md:hidden">
|
|
50
|
+
showing{" "}
|
|
51
|
+
</Text>
|
|
52
|
+
{paginatedArticles.length} of {totalArticles} articles
|
|
53
|
+
</strong>
|
|
54
|
+
</Text>
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
{/* Filter dropdown */}
|
|
57
|
+
<Select
|
|
58
|
+
options={categoryOptions}
|
|
59
|
+
value={selectedCategory}
|
|
60
|
+
onChange={handleCategoryChange}
|
|
61
|
+
className="w-full md:w-[280px]"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
62
65
|
</div>
|
|
63
66
|
|
|
64
67
|
{/* Articles grid */}
|
|
@@ -89,6 +92,7 @@ export function BlogGridBase({
|
|
|
89
92
|
date={article.blogCreationDate}
|
|
90
93
|
category={article.category}
|
|
91
94
|
image={coverImage}
|
|
95
|
+
imageComponent={imageComponent}
|
|
92
96
|
index={index}
|
|
93
97
|
/>
|
|
94
98
|
);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BlogCardImageProps } from "@shared/contentful/blocks/cards/blog-card/types";
|
|
3
|
+
|
|
1
4
|
export interface BlogCardProps {
|
|
2
5
|
slug: string;
|
|
3
6
|
title?: string;
|
|
@@ -21,6 +24,8 @@ export interface BlogGridBaseProps {
|
|
|
21
24
|
categoryOptions: BlogCategoryOption[];
|
|
22
25
|
onCategoryChange?: (category: BlogCategoryOption) => void;
|
|
23
26
|
onPageChange?: (page: number) => void;
|
|
27
|
+
/** Pass next/image's Image component here to enable image optimization */
|
|
28
|
+
imageComponent?: React.ComponentType<BlogCardImageProps>;
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
export interface BlogCategoryOption {
|
|
@@ -20,6 +20,7 @@ export const BlogCard: React.FC<BlogCardProps> = ({
|
|
|
20
20
|
date,
|
|
21
21
|
category,
|
|
22
22
|
image,
|
|
23
|
+
imageComponent: ImageComponent,
|
|
23
24
|
readMoreText = "Read more",
|
|
24
25
|
asGrid = true,
|
|
25
26
|
lgWidth,
|
|
@@ -41,15 +42,26 @@ export const BlogCard: React.FC<BlogCardProps> = ({
|
|
|
41
42
|
<Link href={href} tabIndex={-1} aria-hidden="true" className="block">
|
|
42
43
|
<div className="h-[232px] w-full flex-shrink-0 overflow-hidden bg-gray-100">
|
|
43
44
|
{image ? (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
ImageComponent ? (
|
|
46
|
+
<ImageComponent
|
|
47
|
+
src={image.src}
|
|
48
|
+
alt={image.alt}
|
|
49
|
+
width={image.width}
|
|
50
|
+
height={image.height}
|
|
51
|
+
className="h-full w-full object-cover transition-transform duration-300 hover:scale-[1.03]"
|
|
52
|
+
sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"
|
|
53
|
+
/>
|
|
54
|
+
) : (
|
|
55
|
+
<img
|
|
56
|
+
src={image.src}
|
|
57
|
+
alt={image.alt}
|
|
58
|
+
width={image.width}
|
|
59
|
+
height={image.height}
|
|
60
|
+
loading="lazy"
|
|
61
|
+
decoding="async"
|
|
62
|
+
className="h-full w-full object-cover transition-transform duration-300 hover:scale-[1.03]"
|
|
63
|
+
/>
|
|
64
|
+
)
|
|
53
65
|
) : (
|
|
54
66
|
<div
|
|
55
67
|
className="h-full w-full bg-gradient-to-br from-gray-200 to-gray-100"
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export interface BlogCardImageProps {
|
|
4
|
+
src: string;
|
|
5
|
+
alt: string;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
sizes?: string;
|
|
10
|
+
loading?: "lazy" | "eager";
|
|
11
|
+
decoding?: "async" | "auto" | "sync";
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
|
|
1
15
|
export interface BlogCardProps {
|
|
2
16
|
href: string;
|
|
3
17
|
title?: string;
|
|
@@ -10,6 +24,8 @@ export interface BlogCardProps {
|
|
|
10
24
|
width: number;
|
|
11
25
|
height: number;
|
|
12
26
|
};
|
|
27
|
+
/** Pass next/image's Image component here to enable image optimization */
|
|
28
|
+
imageComponent?: React.ComponentType<BlogCardImageProps>;
|
|
13
29
|
readMoreText?: string;
|
|
14
30
|
asGrid?: boolean;
|
|
15
31
|
lgWidth?: string;
|