@windstream/react-shared-components 0.0.68 → 0.0.69

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.
@@ -1,11 +1,48 @@
1
- import { CarouselProps } from "./types";
1
+ "use client";
2
+
3
+ import React from "react";
4
+ import { ProductCardCarousel, TestimonialCarousel } from "./helper";
5
+ import {
6
+ CarouselProps,
7
+ CarouselWithProductCards,
8
+ CarouselWithTestimonialCards,
9
+ } from "./types";
2
10
 
3
11
  import { Text } from "@shared/components/text";
4
12
 
5
- export const Carousel: React.FC<{ fields: CarouselProps }> = ({ fields }) => {
13
+ export const Carousel: React.FC<CarouselProps> = ({
14
+ fields,
15
+ hasTestimonialCards,
16
+ hasProductCards,
17
+ disclaimerText,
18
+ backgroundColor,
19
+ }) => {
6
20
  return (
7
- <div>
8
- <Text>Carousel</Text>
21
+ <div className={`${backgroundColor} mx-auto overflow-hidden px-4 py-8`}>
22
+ <div className="relative mx-auto flex max-w-[1280px] flex-col gap-12 overflow-visible">
23
+ <Text
24
+ as="h2"
25
+ className="text-center text-4xl font-bold text-text md:text-5xl"
26
+ >
27
+ {fields?.title}
28
+ </Text>
29
+ {fields?.subTitle && (
30
+ <Text as="h3" className="body1 mt-8 px-4 text-center">
31
+ {fields?.subTitle}
32
+ </Text>
33
+ )}
34
+ {hasTestimonialCards && (
35
+ <TestimonialCarousel
36
+ fields={fields as CarouselWithTestimonialCards}
37
+ />
38
+ )}
39
+ {hasProductCards && (
40
+ <ProductCardCarousel fields={fields as CarouselWithProductCards} />
41
+ )}
42
+ <Text as="div" className="body1 mt-8 px-4 text-center">
43
+ {disclaimerText}
44
+ </Text>
45
+ </div>
9
46
  </div>
10
47
  );
11
48
  };
@@ -1 +1,126 @@
1
- export type CarouselProps = {};
1
+ import { ReactNode } from "react";
2
+
3
+ export interface carouselFieldsInterface {
4
+ __typename: "ComponentCarousel";
5
+ sys: {
6
+ id: string;
7
+ };
8
+ entryName?: string;
9
+ anchorId?: string;
10
+ title?: string;
11
+ subTitle?: string;
12
+ rotationTiming?: number;
13
+ showArrows?: boolean;
14
+ autoRotate?: boolean;
15
+ initialSlideIndex?: number;
16
+ infiniteScroll?: boolean;
17
+ mobileNavigationType?: boolean;
18
+ disclaimerText?: {
19
+ json: any;
20
+ };
21
+ backgroundColor?: "blue" | "green" | "orange" | "purple" | "white";
22
+ items: {
23
+ items: Array<CarouselItemsType>;
24
+ };
25
+ }
26
+
27
+ export type CarouselItemsType =
28
+ | TestimonialCardFields
29
+ | ProductCardFields
30
+ | CardFields;
31
+
32
+ export interface TestimonialCardFields {
33
+ __typename: "ComponentTestimonialCard";
34
+ sys: {
35
+ id: string;
36
+ };
37
+ title?: string;
38
+ author?: string;
39
+ role?: string;
40
+ rating?: number;
41
+ quote?: ReactNode;
42
+ authorImage?: {
43
+ url: string;
44
+ title?: string;
45
+ width?: number;
46
+ height?: number;
47
+ } | null;
48
+ avatarurl?: string;
49
+ }
50
+
51
+ export interface ProductCardFields {
52
+ __typename: "ComponentProductCard";
53
+ sys: {
54
+ id: string;
55
+ };
56
+ speed?: string;
57
+ price?: string;
58
+ priceSuffix?: string;
59
+ techType?: string;
60
+ highlighted?: boolean;
61
+ productCardDescription?: string;
62
+ benefitsTitle?: string;
63
+ benefitsExpanded?: boolean;
64
+ innerBadge?: string;
65
+ // GraphQL patterns for nested references
66
+ benefits?: {
67
+ items: Array<any>;
68
+ };
69
+ giftRewards?: {
70
+ list?: {
71
+ items: Array<any>;
72
+ };
73
+ };
74
+ cta?: {
75
+ buttonLabel?: string;
76
+ [key: string]: any;
77
+ };
78
+ innerBadgeIcon?: {
79
+ url: string;
80
+ [key: string]: any;
81
+ };
82
+ }
83
+
84
+ export interface CardFields {
85
+ __typename: "ComponentCard";
86
+ sys: {
87
+ id: string;
88
+ };
89
+ title?: string;
90
+ subtitle?: string;
91
+ eyebrow?: string;
92
+ body?: { json: any };
93
+ image?: { url: string; [key: string]: any };
94
+ cta?: { buttonLabel?: string; [key: string]: any };
95
+ ctaBottom?: { buttonLabel?: string; [key: string]: any };
96
+ }
97
+
98
+ export interface CarouselWithTestimonialCards
99
+ extends Omit<carouselFieldsInterface, "items"> {
100
+ items: {
101
+ items: TestimonialCardFields[];
102
+ };
103
+ }
104
+
105
+ export interface CarouselWithProductCards
106
+ extends Omit<carouselFieldsInterface, "items"> {
107
+ items: {
108
+ items: ProductCardFields[];
109
+ };
110
+ }
111
+
112
+ export const backgroundColorMap = {
113
+ blue: "bg-bg-fill-inverse",
114
+ green: "bg-border-success",
115
+ orange: "bg-orange-500",
116
+ purple: "bg-purple-500",
117
+ white: "bg-white",
118
+ };
119
+
120
+ export type CarouselProps = {
121
+ fields: carouselFieldsInterface;
122
+ hasTestimonialCards: boolean;
123
+ hasProductCards: boolean;
124
+ disclaimerText: ReactNode;
125
+ backgroundColor: string;
126
+ };
@@ -54,4 +54,4 @@ export { TestimonialCard } from "./blocks/cards/testimonial-card";
54
54
  export type { TestimonialCardProps } from "./blocks/cards/testimonial-card/types";
55
55
 
56
56
  export { ProductCard } from "./blocks/cards/product-card";
57
- export type { ProductCardProps } from "./blocks/cards/product-card/types";
57
+ export type { ProductCardProps } from "./blocks/cards/product-card/types";