@windstream/react-shared-components 0.0.100 → 0.1.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.
@@ -0,0 +1,99 @@
1
+ import React from "react";
2
+ import { BlogCardProps } from "./types";
3
+ import Image from "next/image";
4
+ import Link from "next/link";
5
+
6
+ import { Button } from "@shared/components/button";
7
+ import { MaterialIcon } from "@shared/components/material-icon";
8
+ import { Text } from "@shared/components/text";
9
+
10
+ export const BlogCard: React.FC<BlogCardProps> = ({
11
+ href,
12
+ title,
13
+ description,
14
+ date,
15
+ category,
16
+ image,
17
+ readMoreText = "Read more",
18
+ }: BlogCardProps) => {
19
+ return (
20
+ <article className="flex flex-col overflow-hidden rounded-xl bg-white shadow-[0_1px_4px_rgba(0,0,0,0.08),0_4px_16px_rgba(0,0,0,0.06)] transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_4px_12px_rgba(0,0,0,0.12),0_8px_24px_rgba(0,0,0,0.10)]">
21
+ {/* Image */}
22
+ <Link href={href} tabIndex={-1} aria-hidden="true" className="block">
23
+ <div className="aspect-video w-full flex-shrink-0 overflow-hidden bg-gray-100">
24
+ {image ? (
25
+ <Image
26
+ src={image.src}
27
+ alt={image.alt}
28
+ width={image.width}
29
+ height={image.height}
30
+ className="h-full w-full object-cover transition-transform duration-300 hover:scale-[1.03]"
31
+ sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"
32
+ />
33
+ ) : (
34
+ <div
35
+ className="h-full w-full bg-gradient-to-br from-gray-200 to-gray-100"
36
+ aria-hidden="true"
37
+ />
38
+ )}
39
+ </div>
40
+ </Link>
41
+
42
+ {/* Body */}
43
+ <div className="flex flex-1 flex-col gap-5 p-5 pb-6">
44
+ {/* Meta: category + date */}
45
+ <div className="flex items-center gap-2 text-[13px]">
46
+ <span className="text-body2 font-semibold text-text-brand">
47
+ {category}
48
+ </span>
49
+ {date && (
50
+ <>
51
+ <span className="text-xs text-text" aria-hidden="true">
52
+
53
+ </span>
54
+ <time className="text-body2 text-text">{date}</time>
55
+ </>
56
+ )}
57
+ </div>
58
+
59
+ {/* Title */}
60
+ {title && (
61
+ <Link
62
+ href={href}
63
+ className="m-0 line-clamp-3 text-heading6 font-black transition-colors duration-150 hover:text-text-brand"
64
+ >
65
+ {title}
66
+ </Link>
67
+ )}
68
+
69
+ {/* Excerpt */}
70
+ {description && (
71
+ <Text className="m-0 line-clamp-3 flex-1 text-body1">
72
+ {description}
73
+ </Text>
74
+ )}
75
+
76
+ {/* Read more */}
77
+ <Link
78
+ href={href}
79
+ className="group mt-auto inline-flex justify-between pt-3 text-sm text-text-brand no-underline transition-all duration-200 hover:gap-2.5 hover:text-[#007ab8]"
80
+ aria-label={`${readMoreText} about ${title || "this article"}`}
81
+ >
82
+ <Button
83
+ aria-label={`${readMoreText} about ${title || "this article"}`}
84
+ className="flex w-36 justify-around text-nowrap text-label1 font-black"
85
+ >
86
+ {readMoreText}
87
+ <MaterialIcon
88
+ name="expand_circle_right"
89
+ fill={0}
90
+ size={24}
91
+ weight="600"
92
+ />
93
+ </Button>
94
+ </Link>
95
+ </div>
96
+ </article>
97
+ );
98
+ };
99
+ export default BlogCard;
@@ -0,0 +1,14 @@
1
+ export interface BlogCardProps {
2
+ href: string;
3
+ title?: string;
4
+ description?: string;
5
+ date?: string;
6
+ category?: string;
7
+ image?: {
8
+ src: string;
9
+ alt: string;
10
+ width: number;
11
+ height: number;
12
+ };
13
+ readMoreText?: string;
14
+ }
@@ -123,7 +123,9 @@ export const ProductCard: React.FC<ProductCardProps> = ({
123
123
  width={24}
124
124
  height={24}
125
125
  />
126
- <Text as="div" className="text-sm font-bold">{badge.title}</Text>
126
+ <Text as="div" className="text-sm font-bold">
127
+ {badge.title}
128
+ </Text>
127
129
  </div>
128
130
  );
129
131
  })}
@@ -75,7 +75,10 @@ export const FindKinetic: React.FC<FindKineticProps> = ({
75
75
  }
76
76
  return rearranged.map((item, index: number) => (
77
77
  <li key={`item-list-2-${index}`}>
78
- <Link href={`/local/${item.code.toLowerCase()}`} className="label1">
78
+ <Link
79
+ href={`/local/${item.code.toLowerCase()}`}
80
+ className="label1"
81
+ >
79
82
  {item.name}
80
83
  </Link>
81
84
  </li>
@@ -100,7 +103,10 @@ export const FindKinetic: React.FC<FindKineticProps> = ({
100
103
  }
101
104
  return rearranged.map((item, index: number) => (
102
105
  <li key={`item-list-3-${index}`}>
103
- <Link href={`/local/${item.code.toLowerCase()}`} className="label1">
106
+ <Link
107
+ href={`/local/${item.code.toLowerCase()}`}
108
+ className="label1"
109
+ >
104
110
  {item.name}
105
111
  </Link>
106
112
  </li>
@@ -0,0 +1,91 @@
1
+ import React, { useState } from "react";
2
+ import { SearchBlockProps } from "./types";
3
+
4
+ import { Button } from "@shared/components/button";
5
+ import { Input } from "@shared/components/input";
6
+ import { MaterialIcon } from "@shared/components/material-icon";
7
+ import { Text } from "@shared/components/text";
8
+ import { cx } from "@shared/utils";
9
+
10
+ export const SearchBlock: React.FC<SearchBlockProps> = props => {
11
+ const {
12
+ anchorId = "SearchBlock",
13
+ title,
14
+ subTitle,
15
+ enableHeading,
16
+ searchDescription,
17
+ searchInputPlaceholder,
18
+ basicCaption,
19
+ caption,
20
+ backgroundColor,
21
+ color,
22
+ onSubmit,
23
+ } = props;
24
+ const [searchText, setSearchText] = useState("");
25
+ const themeColorClasses = {
26
+ supporting: "bg-bg-fill-brand-supporting",
27
+ white: "bg-bg",
28
+ brand: "bg-bg-fill-brand",
29
+ };
30
+
31
+ const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
32
+ e.preventDefault();
33
+ onSubmit?.({ searchText });
34
+ };
35
+
36
+ return (
37
+ <div
38
+ className={`py-10 md:py-20 ${themeColorClasses[backgroundColor]} ${color == "dark" ? "text-text" : "text-white"}`}
39
+ id={anchorId}
40
+ data-testid="search-block"
41
+ >
42
+ <div className={"flex justify-center"}>
43
+ <div className="w-[1200px]">
44
+ <div className="mb-8 text-center">
45
+ <Text
46
+ as={enableHeading ? "h1" : "h2"}
47
+ className={cx("heading2 md:heading1")}
48
+ >
49
+ {title}
50
+ </Text>
51
+ {subTitle && (
52
+ <Text as="div" className={cx("subheading2 mt-2 md:subheading1")}>
53
+ {subTitle}
54
+ </Text>
55
+ )}
56
+ </div>
57
+ {searchDescription ? (
58
+ <Text className={`heading6 text-center`}>{searchDescription}</Text>
59
+ ) : null}
60
+
61
+ <span className="w-full">
62
+ <form
63
+ onSubmit={handleSubmit}
64
+ className="flex items-center rounded-md border bg-bg transition-colors focus-within:border-border-focus"
65
+ >
66
+ <Button type="submit" className="ml-2 inline-flex">
67
+ <MaterialIcon name="search" />
68
+ </Button>
69
+ <div className="flex-grow">
70
+ <Input
71
+ value={searchText}
72
+ onChange={(e: {
73
+ target: { value: React.SetStateAction<string> };
74
+ }) => setSearchText(e.target.value)}
75
+ placeholder={searchInputPlaceholder}
76
+ containerClassName="px-4 pl-0 rounded-md flex-grow border-none"
77
+ className={"body3 rounded-md"}
78
+ />
79
+ </div>
80
+ </form>
81
+ </span>
82
+ {caption ? caption : null}
83
+ {basicCaption}
84
+ </div>
85
+ </div>
86
+ </div>
87
+ );
88
+ };
89
+
90
+
91
+ export default SearchBlock;
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+
3
+ export type SearchBlockProps = {
4
+ anchorId?: string;
5
+ title?: string;
6
+ subTitle?: string;
7
+ searchDescription?: string;
8
+ searchInputPlaceholder?: string;
9
+ caption?: React.ReactNode;
10
+ basicCaption?: React.ReactNode;
11
+ enableHeading?: boolean;
12
+ backgroundColor: "supporting" | "white" | "brand";
13
+ color: "light" | "dark";
14
+ onSubmit?: (values: { searchText: string }) => void;
15
+ };
@@ -55,3 +55,15 @@ export type { TestimonialCardProps } from "./blocks/cards/testimonial-card/types
55
55
 
56
56
  export { ProductCard } from "./blocks/cards/product-card";
57
57
  export type { ProductCardProps } from "./blocks/cards/product-card/types";
58
+
59
+ export { BlogCard } from "./blocks/cards/blog-card";
60
+ export type { BlogCardProps } from "./blocks/cards/blog-card/types";
61
+
62
+ export { BlogGrid } from "./blocks/blogs-grid";
63
+ export type { BlogGridProps } from "./blocks/blogs-grid/types";
64
+
65
+ export { BreadcrumbNavigation } from "./blocks/breadcrumbs";
66
+ export type { BreadcrumbNavigationProps } from "./blocks/breadcrumbs/types";
67
+
68
+ export {SearchBlock} from "./blocks/search-block";
69
+ export type {SearchBlockProps} from "./blocks/search-block/types";