@windstream/react-shared-components 0.0.84 → 0.0.87

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,12 +1,91 @@
1
+ "use client";
2
+
3
+ import React from "react";
4
+ import {
5
+ backdropAnimationVariants,
6
+ contentAnimationVariants,
7
+ sizeToPixel,
8
+ } from "./constants";
1
9
  import { ModalProps } from "./types";
10
+ import { motion } from "framer-motion";
2
11
 
12
+ import * as Dialog from "@radix-ui/react-dialog";
13
+ import { MaterialIcon } from "@shared/components/material-icon";
3
14
  import { Text } from "@shared/components/text";
15
+ import { Button } from "@shared/contentful/blocks/button";
16
+ import { cx } from "@shared/utils";
17
+
18
+ export const Modal: React.FC<ModalProps> = props => {
19
+ const {
20
+ isOpen,
21
+ onRequestClose,
22
+ size,
23
+ title,
24
+ content,
25
+ description,
26
+ children,
27
+ bodyClassName,
28
+ } = props;
4
29
 
5
- export const Modal: React.FC<{ fields: ModalProps }> = ({ fields }) => {
6
30
  return (
7
- <div>
8
- <Text>Modal Block</Text>
9
- </div>
31
+ <Dialog.Root
32
+ open={isOpen}
33
+ onOpenChange={() => isOpen && onRequestClose?.()}
34
+ >
35
+ <Dialog.Portal>
36
+ <motion.div
37
+ initial="closed"
38
+ animate={isOpen ? "open" : "closed"}
39
+ variants={backdropAnimationVariants}
40
+ transition={{ type: "tween", duration: 0.2, ease: "easeInOut" }}
41
+ className="fixed inset-0 z-[1000] bg-scrim-bg-modal"
42
+ >
43
+ <Dialog.Overlay />
44
+ </motion.div>
45
+ <motion.div
46
+ initial="closed"
47
+ animate={isOpen ? "open" : "closed"}
48
+ variants={contentAnimationVariants}
49
+ transition={{ type: "tween", duration: 0.3, ease: "easeInOut" }}
50
+ className="fixed left-1/2 top-1/2 z-[1001] w-auto -translate-x-1/2 -translate-y-1/2 focus:outline-none"
51
+ >
52
+ <Dialog.Content
53
+ className={cx(
54
+ "fixed left-[50%] top-[50%] w-[90vw] translate-x-[-50%] translate-y-[-50%] rounded-[6px] bg-bg p-[25px] shadow-[hsl(206_22%_7%_/_35%)_0px_10px_38px_-10px,_hsl(206_22%_7%_/_20%)_0px_10px_20px_-15px] focus:outline-none",
55
+ bodyClassName
56
+ )}
57
+ style={{ maxWidth: sizeToPixel[size || "lg"] }}
58
+ >
59
+ <Dialog.Close asChild={true}>
60
+ <Button
61
+ showButtonAs="unstyled"
62
+ buttonClassName="absolute right-0 top-0 mr-2 mt-2 bg-bg"
63
+ >
64
+ <MaterialIcon name="close" />
65
+ </Button>
66
+ </Dialog.Close>
67
+ <div className="custom-modal-body max-h-[85vh] overflow-visible">
68
+ {title ? (
69
+ <Text
70
+ className={cx(
71
+ "mx-auto mb-3 mt-5 text-center",
72
+ "heading5 md:max-w-[80%] md:pt-0",
73
+ "mb-5 md:mb-[60px]"
74
+ )}
75
+ as="h2"
76
+ >
77
+ {title}
78
+ </Text>
79
+ ) : null}
80
+
81
+ {description ? <Text as="div">{description}</Text> : null}
82
+
83
+ {content}
84
+ {children ? children : null}
85
+ </div>
86
+ </Dialog.Content>
87
+ </motion.div>
88
+ </Dialog.Portal>
89
+ </Dialog.Root>
10
90
  );
11
91
  };
12
- export default Modal;
@@ -1 +1,12 @@
1
- export type ModalProps = {};
1
+ import React from "react";
2
+
3
+ export type ModalProps = {
4
+ isOpen: boolean;
5
+ onRequestClose?: () => void;
6
+ size?: "lg" | "md" | "sm" | "xl" | "xs";
7
+ title?: string;
8
+ description?: React.ReactNode;
9
+ content?: React.ReactNode;
10
+ children?: React.ReactNode;
11
+ bodyClassName?: string;
12
+ };
@@ -5,6 +5,7 @@ import { NavigationProps } from "./types";
5
5
 
6
6
  import { CallButton } from "@shared/components/call-button";
7
7
  import { Input } from "@shared/components/input";
8
+ import { Link } from "@shared/components/link";
8
9
  import { MaterialIcon } from "@shared/components/material-icon";
9
10
  import { NextImage } from "@shared/components/next-image";
10
11
  import { Text } from "@shared/components/text";
@@ -66,16 +67,18 @@ export const Navigation: React.FC<NavigationProps> = props => {
66
67
  <div className="main-nav-container" aria-label="Main Navigation">
67
68
  <div className="mobile-nav-section flex h-14 items-center justify-between px-5 py-[10px] lg:hidden">
68
69
  <div>
69
- <NextImage
70
- src={
71
- typeof primaryNavigationLogo === "string"
72
- ? primaryNavigationLogo
73
- : primaryNavigationLogo?.url || ""
74
- }
75
- alt="Kinetic business logo"
76
- width={76.5}
77
- height={24}
78
- />
70
+ <Link href="/" className="flex">
71
+ <NextImage
72
+ src={
73
+ typeof primaryNavigationLogo === "string"
74
+ ? primaryNavigationLogo
75
+ : primaryNavigationLogo?.url || ""
76
+ }
77
+ alt="Kinetic business logo"
78
+ width={76.5}
79
+ height={24}
80
+ />
81
+ </Link>
79
82
  </div>
80
83
  <div className="flex items-center gap-6">
81
84
  <CallButton href={invocaPhoneNumberLink}>
@@ -90,17 +93,19 @@ export const Navigation: React.FC<NavigationProps> = props => {
90
93
  <div className="desktop-nav-section hidden lg:block lg:border-b lg:px-2">
91
94
  <div className="mx-auto flex h-14 max-w-120 items-center justify-between">
92
95
  <div className="flex h-full">
93
- <NextImage
94
- src={
95
- typeof primaryNavigationLogo === "string"
96
- ? primaryNavigationLogo
97
- : primaryNavigationLogo?.url || ""
98
- }
99
- alt="Kinetic business logo"
100
- width={76.5}
101
- height={24}
102
- className="mr-14"
103
- />
96
+ <Link href="/" className="flex">
97
+ <NextImage
98
+ src={
99
+ typeof primaryNavigationLogo === "string"
100
+ ? primaryNavigationLogo
101
+ : primaryNavigationLogo?.url || ""
102
+ }
103
+ alt="Kinetic business logo"
104
+ width={76.5}
105
+ height={24}
106
+ className="mr-14"
107
+ />
108
+ </Link>
104
109
 
105
110
  <div className="flex h-full items-center gap-5">
106
111
  {primaryNavigationLinks?.map((links, index) => {
@@ -1,23 +0,0 @@
1
- import { Modal } from "./index";
2
-
3
- import { DocsPage } from "@shared/stories/DocsTemplate";
4
- import type { Meta, StoryObj } from "@storybook/react";
5
-
6
- const meta: Meta<typeof Modal> = {
7
- title: "Contentful Blocks/Modal",
8
- component: Modal,
9
- tags: ["autodocs"],
10
- parameters: {
11
- layout: "centered",
12
- docs: {
13
- page: DocsPage,
14
- description: {
15
- component: "Contentful modal block.",
16
- },
17
- },
18
- },
19
- args: { fields: {} },
20
- };
21
- export default meta;
22
- type Story = StoryObj<typeof meta>;
23
- export const Default: Story = {};