@grantbii/design-system 1.0.36 → 1.0.38

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.
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import Image from "next/image";
3
3
  import darkLogo from "../../public/logos/brand_logo-dark.webp";
4
4
  import lightLogo from "../../public/logos/brand_logo-light.webp";
5
- const BrandLogo = ({ width = 250, height = 80, isDarkTheme = true, alt = "Grantbii", }) => (_jsx(Image, { src: isDarkTheme ? darkLogo : lightLogo, alt: alt, width: width, height: height }));
5
+ const BrandLogo = ({ width = 250, height = 80, isDarkTheme = true, alt = "Grantbii", }) => (_jsx(Image, { src: isDarkTheme ? darkLogo : lightLogo, alt: alt, width: width, height: height, priority: true }));
6
6
  export default BrandLogo;
@@ -0,0 +1,17 @@
1
+ import { MouseEventHandler, ReactNode } from "react";
2
+ type ModalProps = {
3
+ header?: ReactNode;
4
+ content: ReactNode;
5
+ footer?: ReactNode;
6
+ width?: string;
7
+ height?: string;
8
+ isFullScreen?: boolean;
9
+ onClickCancel: MouseEventHandler<HTMLButtonElement>;
10
+ };
11
+ declare const Modal: ({ header, content, footer, width, height, isFullScreen, onClickCancel, }: ModalProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default Modal;
13
+ export declare const useModal: () => {
14
+ showModal: boolean;
15
+ openModal: () => void;
16
+ closeModal: () => void;
17
+ };
@@ -0,0 +1,88 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useState } from "react";
3
+ import styled from "styled-components";
4
+ import { Button } from "../atoms";
5
+ import { Colors } from "../foundations";
6
+ const Modal = ({ header, content, footer, width, height, isFullScreen, onClickCancel, }) => (_jsx(Overlay, { children: _jsxs(ModalWindow, { "$isFullScreen": isFullScreen, "$width": width, children: [header ? _jsx(ModalHeader, { children: header }) : _jsx(_Fragment, {}), _jsx(ModalBody, { "$isFullScreen": isFullScreen, "$height": height, children: content }), _jsxs(ModalFooter, { children: [_jsx(CancelButton, { onClick: onClickCancel }), footer ? footer : _jsx(_Fragment, {})] })] }) }));
7
+ export default Modal;
8
+ export const useModal = () => {
9
+ const [showModal, setShowModal] = useState(false);
10
+ const lockScroll = useCallback(() => {
11
+ document.body.style.overflow = "hidden";
12
+ }, []);
13
+ const unlockScroll = useCallback(() => {
14
+ document.body.style.overflow = "initial";
15
+ }, []);
16
+ const openModal = () => {
17
+ setShowModal(true);
18
+ lockScroll();
19
+ };
20
+ const closeModal = () => {
21
+ setShowModal(false);
22
+ unlockScroll();
23
+ };
24
+ return {
25
+ showModal,
26
+ openModal,
27
+ closeModal,
28
+ };
29
+ };
30
+ const Overlay = styled.div `
31
+ background-color: ${Colors.semantic.overlay};
32
+
33
+ z-index: ${Number.MAX_SAFE_INTEGER};
34
+ position: fixed;
35
+ top: 0px;
36
+ left: 0px;
37
+
38
+ width: 100vw;
39
+ height: 100vh;
40
+
41
+ display: flex;
42
+ flex-direction: column;
43
+ justify-content: center;
44
+ align-items: center;
45
+ `;
46
+ const ModalWindow = styled.div `
47
+ background-color: ${Colors.base.white};
48
+ border-radius: ${({ $isFullScreen }) => ($isFullScreen ? 0 : 6)}px;
49
+
50
+ width: ${({ $isFullScreen, $width = "auto" }) => $isFullScreen ? "100%" : $width};
51
+
52
+ height: ${({ $isFullScreen }) => ($isFullScreen ? "100%" : "auto")};
53
+ min-height: 100px;
54
+ `;
55
+ const ModalHeader = styled.div `
56
+ font-weight: 500;
57
+ font-size: 18px;
58
+
59
+ padding: 12px 24px;
60
+ border-bottom: 1px solid ${Colors.neutral.grey3};
61
+ `;
62
+ const ModalBody = styled.div `
63
+ display: flex;
64
+ flex-direction: column;
65
+ gap: 12px;
66
+
67
+ height: ${({ $isFullScreen, $height = "auto" }) => $isFullScreen ? "calc(100% - 160px)" : $height};
68
+
69
+ padding-top: 24px;
70
+
71
+ > * {
72
+ width: 100%;
73
+ height: 100%;
74
+
75
+ padding: 0px 24px;
76
+ border: none;
77
+
78
+ overflow-y: auto;
79
+ }
80
+ `;
81
+ const ModalFooter = styled.div `
82
+ display: flex;
83
+ justify-content: space-between;
84
+ gap: 12px;
85
+
86
+ padding: 24px;
87
+ `;
88
+ const CancelButton = ({ onClick }) => (_jsx(Button, { text: "Cancel", onClick: onClick, backgroundColor: Colors.neutral.grey3, color: Colors.typography.blackHigh }));
@@ -0,0 +1 @@
1
+ export { default as Modal, useModal } from "./Modal";
@@ -0,0 +1 @@
1
+ export { default as Modal, useModal } from "./Modal";
package/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from "./core/atoms";
2
2
  export * from "./core/foundations";
3
3
  export { default as GlobalStyle } from "./core/global/GlobalStyle";
4
4
  export * from "./core/integrations";
5
+ export * from "./core/molecules";
package/index.js CHANGED
@@ -2,3 +2,4 @@ export * from "./core/atoms";
2
2
  export * from "./core/foundations";
3
3
  export { default as GlobalStyle } from "./core/global/GlobalStyle";
4
4
  export * from "./core/integrations";
5
+ export * from "./core/molecules";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grantbii/design-system",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "Grantbii's Design System",
5
5
  "homepage": "https://design.grantbii.com",
6
6
  "repository": {
@@ -25,7 +25,7 @@ export const Icon = {
25
25
  export const Closeable = {
26
26
  args: {
27
27
  text: defaultText,
28
- onClickClose: onClickClose,
28
+ onClickClose,
29
29
  },
30
30
  };
31
31
  export const LongText = {
@@ -39,6 +39,6 @@ export const Everything = {
39
39
  Icon: Icons.SmileyXEyesIcon,
40
40
  text: longText,
41
41
  textWidthPixels: 160,
42
- onClickClose: onClickClose,
42
+ onClickClose,
43
43
  },
44
44
  };
@@ -8,4 +8,3 @@ export declare const TextOnly: Story;
8
8
  export declare const LeftIcon: Story;
9
9
  export declare const RightIcon: Story;
10
10
  export declare const BothIcons: Story;
11
- export declare const Wide: Story;
@@ -24,6 +24,3 @@ export const RightIcon = {
24
24
  export const BothIcons = {
25
25
  args: Object.assign(Object.assign({}, baseArgs), { LeftIcon: Icons.SmileyXEyesIcon, RightIcon: Icons.SmileyMeltingIcon }),
26
26
  };
27
- export const Wide = {
28
- args: Object.assign({}, baseArgs),
29
- };
@@ -0,0 +1,17 @@
1
+ import type { StoryObj } from "@storybook/nextjs-vite";
2
+ import { Meta } from "@storybook/nextjs-vite";
3
+ import { ReactNode } from "react";
4
+ type ModalExampleProps = {
5
+ header?: ReactNode;
6
+ content: ReactNode;
7
+ footer?: ReactNode;
8
+ width?: string;
9
+ height?: string;
10
+ isFullScreen?: boolean;
11
+ };
12
+ declare const ModalExample: (props: ModalExampleProps) => import("react/jsx-runtime").JSX.Element;
13
+ declare const meta: Meta<typeof ModalExample>;
14
+ export default meta;
15
+ type Story = StoryObj<typeof meta>;
16
+ export declare const DesktopVersion: Story;
17
+ export declare const MobileVersion: Story;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Modal, useModal } from "@/.";
3
+ const ModalExample = (props) => {
4
+ const { showModal, openModal, closeModal } = useModal();
5
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { text: "Click to open modal", onClick: openModal }), showModal ? (_jsx(Modal, Object.assign({}, props, { onClickCancel: () => closeModal() }))) : (_jsx(_Fragment, {}))] }));
6
+ };
7
+ const meta = {
8
+ title: "Molecules/Modal",
9
+ component: ModalExample,
10
+ tags: ["autodocs"],
11
+ parameters: {
12
+ layout: "centered",
13
+ },
14
+ };
15
+ export default meta;
16
+ const header = "What is Grantbii?";
17
+ const text = "Grantbii is an AI-powered grant intelligence and matching platform that helps grant seekers effortlessly find, match, prep & apply for the right business grants - maximizing grant funding success with minimal effort. Our platform connects businesses with a trusted Grant Enabler Network - solution providers, consulting experts, and delivery partners - ensuring that every dollar of grant funding leads to real business transformation impact.";
18
+ export const DesktopVersion = {
19
+ args: {
20
+ header,
21
+ content: _jsx("p", { children: text }),
22
+ width: "600px",
23
+ },
24
+ };
25
+ export const MobileVersion = {
26
+ args: {
27
+ header,
28
+ content: _jsx("p", { children: text }),
29
+ isFullScreen: true,
30
+ },
31
+ };