@windstream/react-shared-components 0.2.0 → 0.2.1
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.esm.js +2 -2
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +1 -1
- package/dist/contentful/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/contentful/blocks/breadcrumbs/index.tsx +95 -95
- package/src/contentful/blocks/find-kinetic/index.tsx +147 -164
|
@@ -1,164 +1,147 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { FindKineticProps, ThemeKey } from "./types";
|
|
3
|
-
|
|
4
|
-
import { Link } from "@shared/components/link";
|
|
5
|
-
import { Text } from "@shared/components/text";
|
|
6
|
-
import { NextImage } from "@shared/next";
|
|
7
|
-
|
|
8
|
-
export const FindKinetic: React.FC<FindKineticProps> = ({
|
|
9
|
-
background = "white",
|
|
10
|
-
description,
|
|
11
|
-
enableHeading,
|
|
12
|
-
image,
|
|
13
|
-
list = [],
|
|
14
|
-
localPathPrefix = "/local",
|
|
15
|
-
subTitle,
|
|
16
|
-
title,
|
|
17
|
-
color = "dark",
|
|
18
|
-
maxWidth = true,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
})()}
|
|
149
|
-
</ul>
|
|
150
|
-
</>
|
|
151
|
-
)}
|
|
152
|
-
</div>
|
|
153
|
-
{image && (
|
|
154
|
-
<aside className="hidden md:block xl:flex-shrink-0">
|
|
155
|
-
<NextImage width={472} height={100} src={image} alt="image" />
|
|
156
|
-
</aside>
|
|
157
|
-
)}
|
|
158
|
-
</div>
|
|
159
|
-
</div>
|
|
160
|
-
</div>
|
|
161
|
-
);
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
export default FindKinetic;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FindKineticProps, ThemeKey } from "./types";
|
|
3
|
+
|
|
4
|
+
import { Link } from "@shared/components/link";
|
|
5
|
+
import { Text } from "@shared/components/text";
|
|
6
|
+
import { NextImage } from "@shared/next";
|
|
7
|
+
|
|
8
|
+
export const FindKinetic: React.FC<FindKineticProps> = ({
|
|
9
|
+
background = "white",
|
|
10
|
+
description,
|
|
11
|
+
enableHeading,
|
|
12
|
+
image,
|
|
13
|
+
list = [],
|
|
14
|
+
localPathPrefix = "/local",
|
|
15
|
+
subTitle,
|
|
16
|
+
title,
|
|
17
|
+
color = "dark",
|
|
18
|
+
maxWidth = true,
|
|
19
|
+
}) => {
|
|
20
|
+
const bgColorClasses: Record<ThemeKey, string> = {
|
|
21
|
+
blue: "bg-[#07B2E2]",
|
|
22
|
+
green: "bg-[#26B170]",
|
|
23
|
+
yellow: "bg-[#F5FF1E]",
|
|
24
|
+
purple: "bg-[#931D69]",
|
|
25
|
+
white: "bg-white",
|
|
26
|
+
navy: "bg-[#00002D]",
|
|
27
|
+
};
|
|
28
|
+
const normalizedLocalPathPrefix = localPathPrefix
|
|
29
|
+
? `/${localPathPrefix.replace(/^\/+|\/+$/g, "")}`
|
|
30
|
+
: "";
|
|
31
|
+
|
|
32
|
+
const getLocationHref = (code: string) =>
|
|
33
|
+
`${normalizedLocalPathPrefix}/${code.toLowerCase()}`;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
className={`${bgColorClasses[background]} component-container overflow-hidden ${color == "dark" ? "text-text" : "text-white"}`}
|
|
38
|
+
>
|
|
39
|
+
<div
|
|
40
|
+
className={`${maxWidth ? "max-w-120 xl:mx-auto" : ""} mx-5 mb-5 ${image ? "mt-12" : "mt-0 xl:mt-0"} xl:my-20`}
|
|
41
|
+
>
|
|
42
|
+
{title && (
|
|
43
|
+
<Text
|
|
44
|
+
as={enableHeading ? "h1" : "h2"}
|
|
45
|
+
className="heading2 md:heading1 md:text-center"
|
|
46
|
+
>
|
|
47
|
+
{title}
|
|
48
|
+
</Text>
|
|
49
|
+
)}
|
|
50
|
+
{subTitle && (
|
|
51
|
+
<Text
|
|
52
|
+
as={enableHeading ? "h2" : "h3"}
|
|
53
|
+
className="subheading1 mt-4 md:text-center"
|
|
54
|
+
>
|
|
55
|
+
{subTitle}
|
|
56
|
+
</Text>
|
|
57
|
+
)}
|
|
58
|
+
|
|
59
|
+
<div
|
|
60
|
+
className={`mt-8 flex flex-col items-center xl:flex-row ${image ? "xl:mt-16" : "xl:mt-10"} gap-10`}
|
|
61
|
+
>
|
|
62
|
+
<div
|
|
63
|
+
className={`flex flex-col ${image ? "items:center xl:items-start" : "items-center"} gap-10 self-stretch xl:flex-[1_0_0]`}
|
|
64
|
+
>
|
|
65
|
+
{description && (
|
|
66
|
+
<Text as="p" className="body1">
|
|
67
|
+
{description}
|
|
68
|
+
</Text>
|
|
69
|
+
)}
|
|
70
|
+
{list.length > 0 && (
|
|
71
|
+
<>
|
|
72
|
+
<ul className="grid w-full grid-cols-2 gap-x-6 gap-y-5 md:hidden">
|
|
73
|
+
{(() => {
|
|
74
|
+
const sortedList = [...list].sort((a, b) =>
|
|
75
|
+
a.name.localeCompare(b.name)
|
|
76
|
+
);
|
|
77
|
+
const numColumns = 2;
|
|
78
|
+
const numRows = Math.ceil(sortedList.length / numColumns);
|
|
79
|
+
const rearranged = [];
|
|
80
|
+
for (let row = 0; row < numRows; row++) {
|
|
81
|
+
for (let col = 0; col < numColumns; col++) {
|
|
82
|
+
const index = col * numRows + row;
|
|
83
|
+
if (index < sortedList.length) {
|
|
84
|
+
rearranged.push(sortedList[index]);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return rearranged.map((item, index: number) => (
|
|
89
|
+
<li key={`item-list-2-${index}`}>
|
|
90
|
+
<Link
|
|
91
|
+
href={getLocationHref(item.code)}
|
|
92
|
+
className="label1"
|
|
93
|
+
>
|
|
94
|
+
{item.name}
|
|
95
|
+
</Link>
|
|
96
|
+
</li>
|
|
97
|
+
));
|
|
98
|
+
})()}
|
|
99
|
+
</ul>
|
|
100
|
+
<ul
|
|
101
|
+
className={`hidden ${image ? "gap-x-6" : "gap-x-20"} gap-y-5 md:grid ${image ? "md:grid-cols-3" : "md:grid-cols-4"}`}
|
|
102
|
+
>
|
|
103
|
+
{(() => {
|
|
104
|
+
const sortedList = [...list].sort((a, b) =>
|
|
105
|
+
a.name.localeCompare(b.name)
|
|
106
|
+
);
|
|
107
|
+
const numColumns = 3;
|
|
108
|
+
const numRows = Math.ceil(sortedList.length / numColumns);
|
|
109
|
+
const rearranged = [];
|
|
110
|
+
for (let row = 0; row < numRows; row++) {
|
|
111
|
+
for (let col = 0; col < numColumns; col++) {
|
|
112
|
+
const index = col * numRows + row;
|
|
113
|
+
if (index < sortedList.length) {
|
|
114
|
+
rearranged.push(sortedList[index]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return rearranged.map((item, index: number) => (
|
|
119
|
+
<li
|
|
120
|
+
key={`item-list-3-${index}`}
|
|
121
|
+
className={`${image ? "" : "w-[172px]"}`}
|
|
122
|
+
>
|
|
123
|
+
<Link
|
|
124
|
+
href={getLocationHref(item.code)}
|
|
125
|
+
className="label1"
|
|
126
|
+
>
|
|
127
|
+
{item.name}
|
|
128
|
+
</Link>
|
|
129
|
+
</li>
|
|
130
|
+
));
|
|
131
|
+
})()}
|
|
132
|
+
</ul>
|
|
133
|
+
</>
|
|
134
|
+
)}
|
|
135
|
+
</div>
|
|
136
|
+
{image && (
|
|
137
|
+
<aside className="hidden md:block">
|
|
138
|
+
<NextImage width={472} height={100} src={image} alt="image" />
|
|
139
|
+
</aside>
|
|
140
|
+
)}
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export default FindKinetic;
|