@grantbii/design-system 1.4.1 → 1.4.2
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/core/molecules/Modal.d.ts +3 -3
- package/core/molecules/Modal.js +2 -2
- package/core/molecules/Modal.js.map +1 -1
- package/core/organisms/GrantMatch/GrantMatchModal.d.ts +5 -1
- package/core/organisms/GrantMatch/GrantMatchModal.js +12 -3
- package/core/organisms/GrantMatch/GrantMatchModal.js.map +1 -1
- package/core/organisms/GrantMatch/SearchBar.d.ts +5 -1
- package/core/organisms/GrantMatch/SearchBar.js +20 -9
- package/core/organisms/GrantMatch/SearchBar.js.map +1 -1
- package/core/organisms/GrantMatch/index.d.ts +5 -1
- package/core/organisms/GrantMatch/index.js +3 -2
- package/core/organisms/GrantMatch/index.js.map +1 -1
- package/core/organisms/TallyModal.d.ts +1 -1
- package/core/organisms/TallyModal.js +1 -1
- package/core/organisms/TallyModal.js.map +1 -1
- package/package.json +8 -8
- package/stories/molecules/Modal.stories.js +1 -1
- package/stories/molecules/Modal.stories.js.map +1 -1
- package/stories/organisms/GrantMatch.stories.d.ts +9 -2
- package/stories/organisms/GrantMatch.stories.js +11 -3
- package/stories/organisms/GrantMatch.stories.js.map +1 -1
- package/stories/organisms/TallyModal.stories.js +1 -1
- package/stories/organisms/TallyModal.stories.js.map +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -5,10 +5,10 @@ type ModalProps = {
|
|
|
5
5
|
footer?: ReactNode;
|
|
6
6
|
width?: string;
|
|
7
7
|
height?: string;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
onClickClose: MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
closeText?: string;
|
|
10
10
|
};
|
|
11
|
-
declare const Modal: ({ header, content, footer, width, height,
|
|
11
|
+
declare const Modal: ({ header, content, footer, width, height, onClickClose, closeText, }: ModalProps) => import("react").ReactPortal;
|
|
12
12
|
export default Modal;
|
|
13
13
|
export declare const useModal: () => {
|
|
14
14
|
showModal: boolean;
|
package/core/molecules/Modal.js
CHANGED
|
@@ -4,7 +4,7 @@ import styled from "styled-components";
|
|
|
4
4
|
import { Button } from "../atoms";
|
|
5
5
|
import { Colors, Responsive } from "../foundations";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
|
-
const Modal = ({ header, content, footer, width, height,
|
|
7
|
+
const Modal = ({ header, content, footer, width, height, onClickClose, closeText, }) => createPortal(_jsx(Overlay, { children: _jsxs(ModalWindow, { "$width": width, "$height": height, children: [header ? _jsx(ModalHeader, { children: header }) : _jsx(_Fragment, {}), _jsx(ModalBody, { children: content }), _jsxs(ModalFooter, { children: [_jsx(CloseButton, { onClick: onClickClose, closeText: closeText }), footer ? footer : _jsx(_Fragment, {})] })] }) }), document.body);
|
|
8
8
|
export default Modal;
|
|
9
9
|
export const useModal = () => {
|
|
10
10
|
const [showModal, setShowModal] = useState(false);
|
|
@@ -106,5 +106,5 @@ const ModalFooter = styled.div `
|
|
|
106
106
|
|
|
107
107
|
padding: 24px;
|
|
108
108
|
`;
|
|
109
|
-
const
|
|
109
|
+
const CloseButton = ({ onClick, closeText = "Close" }) => (_jsx(Button, { text: closeText, onClick: onClick, backgroundColor: Colors.neutral.grey3, color: Colors.typography.blackHigh }));
|
|
110
110
|
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../core/molecules/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,WAAW,EACX,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAYzC,MAAM,KAAK,GAAG,CAAC,EACb,MAAM,EACN,OA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,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,EACrC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,GAClC,CACH,CAAC","sourcesContent":["import {\n type JSX,\n type MouseEventHandler,\n type ReactNode,\n useCallback,\n useState,\n} from \"react\";\nimport styled from \"styled-components\";\nimport { Button } from \"../atoms\";\nimport { Colors, Responsive } from \"../foundations\";\nimport { createPortal } from \"react-dom\";\n\ntype ModalProps = {\n header?: ReactNode;\n content: JSX.Element;\n footer?: ReactNode;\n width?: string;\n height?: string;\n onClickClose: MouseEventHandler<HTMLButtonElement>;\n closeText?: string;\n};\n\nconst Modal = ({\n header,\n content,\n footer,\n width,\n height,\n onClickClose,\n closeText,\n}: ModalProps) =>\n createPortal(\n <Overlay>\n <ModalWindow $width={width} $height={height}>\n {header ? <ModalHeader>{header}</ModalHeader> : <></>}\n\n <ModalBody>{content}</ModalBody>\n\n <ModalFooter>\n <CloseButton onClick={onClickClose} closeText={closeText} />\n {footer ? footer : <></>}\n </ModalFooter>\n </ModalWindow>\n </Overlay>,\n document.body,\n );\n\nexport default Modal;\n\nexport const useModal = () => {\n const [showModal, setShowModal] = useState(false);\n\n const lockScroll = useCallback(() => {\n document.body.style.overflow = \"hidden\";\n }, []);\n\n const unlockScroll = useCallback(() => {\n document.body.style.overflow = \"initial\";\n }, []);\n\n const openModal = () => {\n setShowModal(true);\n lockScroll();\n };\n\n const closeModal = () => {\n setShowModal(false);\n unlockScroll();\n };\n\n return {\n showModal,\n openModal,\n closeModal,\n };\n};\n\nconst Overlay = styled.div`\n background-color: ${Colors.semantic.overlay};\n\n z-index: 9999;\n position: fixed;\n top: 0px;\n left: 0px;\n\n width: 100vw;\n height: 100vh;\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n`;\n\nconst ModalWindow = styled.div<{ $width?: string; $height?: string }>`\n display: flex;\n flex-direction: column;\n\n background-color: ${Colors.base.white};\n\n min-height: 100px;\n max-height: 100vh;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n position: fixed;\n bottom: 0px;\n left: 0px;\n\n width: 100%;\n height: 100%;\n\n border-radius: 0px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n position: static;\n bottom: auto;\n left: auto;\n\n width: ${({ $width }) => $width};\n height: ${({ $height }) => $height};\n\n border-radius: 6px;\n }\n`;\n\nconst ModalHeader = styled.div`\n font-weight: 500;\n font-size: 18px;\n\n padding: 12px 24px;\n border-bottom: 1px solid ${Colors.neutral.grey3};\n`;\n\nconst ModalBody = styled.div`\n display: flex;\n flex-direction: column;\n\n height: 100%;\n padding-top: 24px;\n overflow-y: auto;\n\n > * {\n width: 100%;\n height: 100%;\n min-height: 100px;\n\n padding: 2px 24px;\n border: none;\n }\n`;\n\nconst ModalFooter = styled.div`\n display: flex;\n justify-content: space-between;\n gap: 12px;\n\n padding: 24px;\n`;\n\ntype CloseButtonProps = {\n onClick: MouseEventHandler<HTMLButtonElement>;\n closeText?: string;\n};\n\nconst CloseButton = ({ onClick, closeText = \"Close\" }: CloseButtonProps) => (\n <Button\n text={closeText}\n onClick={onClick}\n backgroundColor={Colors.neutral.grey3}\n color={Colors.typography.blackHigh}\n />\n);\n"]}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type GrantMatchModalProps = {
|
|
2
|
+
findGrantsCallback?: () => void;
|
|
3
|
+
closeModalCallback?: () => void;
|
|
4
|
+
};
|
|
5
|
+
declare const GrantMatchModal: ({ findGrantsCallback, closeModalCallback, }: GrantMatchModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
6
|
export default GrantMatchModal;
|
|
@@ -4,10 +4,16 @@ import { Button, Textarea } from "../../atoms";
|
|
|
4
4
|
import { Colors } from "../../foundations";
|
|
5
5
|
import { FileDrop, Modal, useFileDrop } from "../../molecules";
|
|
6
6
|
import { useGrantMatchContext } from "./context";
|
|
7
|
-
const GrantMatchModal = () => {
|
|
7
|
+
const GrantMatchModal = ({ findGrantsCallback, closeModalCallback, }) => {
|
|
8
8
|
const { activeQuery, closeModal } = useGrantMatchContext();
|
|
9
9
|
const { files, uploadFiles, removeFile, errorMessage } = useFileDrop(activeQuery.files);
|
|
10
|
-
|
|
10
|
+
const onClickClose = () => {
|
|
11
|
+
if (closeModalCallback) {
|
|
12
|
+
closeModalCallback();
|
|
13
|
+
}
|
|
14
|
+
closeModal();
|
|
15
|
+
};
|
|
16
|
+
return (_jsx(Modal, { header: _jsx("div", { children: "Grant Match" }), content: _jsx(ModalContent, { files: files, uploadFiles: uploadFiles, removeFile: removeFile, errorMessage: errorMessage }), footer: _jsx(FindGrantsButton, { files: files, findGrantsCallback: findGrantsCallback }), onClickClose: onClickClose, width: "480px", height: "600px" }));
|
|
11
17
|
};
|
|
12
18
|
export default GrantMatchModal;
|
|
13
19
|
const ModalContent = ({ files, uploadFiles, removeFile, errorMessage, }) => {
|
|
@@ -24,9 +30,12 @@ const ModalQueryText = styled.div `
|
|
|
24
30
|
display: flex;
|
|
25
31
|
flex-direction: column;
|
|
26
32
|
`;
|
|
27
|
-
const FindGrantsButton = ({ files }) => {
|
|
33
|
+
const FindGrantsButton = ({ files, findGrantsCallback, }) => {
|
|
28
34
|
const { updateActiveQuery, queryText, closeModal } = useGrantMatchContext();
|
|
29
35
|
const onClick = () => {
|
|
36
|
+
if (findGrantsCallback) {
|
|
37
|
+
findGrantsCallback();
|
|
38
|
+
}
|
|
30
39
|
updateActiveQuery({ files, text: queryText });
|
|
31
40
|
closeModal();
|
|
32
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrantMatchModal.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/GrantMatchModal.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,C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K,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QAC9C,UAAU,EAAE,CAAC;IACf,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAC,gBAAgB,EACrB,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,GACtC,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import styled from \"styled-components\";\nimport { Button, Textarea } from \"../../atoms\";\nimport { Colors } from \"../../foundations\";\nimport { FileDrop, Modal, useFileDrop } from \"../../molecules\";\nimport { useGrantMatchContext } from \"./context\";\n\ntype GrantMatchModalProps = {\n findGrantsCallback?: () => void;\n closeModalCallback?: () => void;\n};\n\nconst GrantMatchModal = ({\n findGrantsCallback,\n closeModalCallback,\n}: GrantMatchModalProps) => {\n const { activeQuery, closeModal } = useGrantMatchContext();\n const { files, uploadFiles, removeFile, errorMessage } = useFileDrop(\n activeQuery.files,\n );\n\n const onClickClose = () => {\n if (closeModalCallback) {\n closeModalCallback();\n }\n\n closeModal();\n };\n\n return (\n <Modal\n header={<div>Grant Match</div>}\n content={\n <ModalContent\n files={files}\n uploadFiles={uploadFiles}\n removeFile={removeFile}\n errorMessage={errorMessage}\n />\n }\n footer={\n <FindGrantsButton\n files={files}\n findGrantsCallback={findGrantsCallback}\n />\n }\n onClickClose={onClickClose}\n width=\"480px\"\n height=\"600px\"\n />\n );\n};\n\nexport default GrantMatchModal;\n\ntype ModalContentProps = {\n files: File[];\n uploadFiles: (acceptedFiles: File[]) => void;\n removeFile: (fileName: string) => void;\n errorMessage?: string;\n};\n\nconst ModalContent = ({\n files,\n uploadFiles,\n removeFile,\n errorMessage,\n}: ModalContentProps) => {\n const { queryText, updateQueryText } = useGrantMatchContext();\n\n return (\n <BaseContent>\n <FileDrop\n uploadedFiles={files}\n uploadFiles={uploadFiles}\n removeFile={removeFile}\n errorMessage={errorMessage}\n />\n\n <ModalQueryText>\n <label htmlFor={QUERY_TEXTAREA_ID}>Search Grants Opportunities</label>\n <Textarea\n id={QUERY_TEXTAREA_ID}\n value={queryText}\n onChange={(event) => updateQueryText(event.target.value)}\n placeholder=\"Explore by grant name or share what your project is about...\"\n />\n </ModalQueryText>\n </BaseContent>\n );\n};\n\nconst QUERY_TEXTAREA_ID = \"query-textarea\";\n\nconst BaseContent = styled.div`\n display: flex;\n flex-direction: column;\n gap: 12px;\n`;\n\nconst ModalQueryText = styled.div`\n display: flex;\n flex-direction: column;\n`;\n\ntype FindGrantsButtonProps = {\n files: File[];\n findGrantsCallback?: () => void;\n};\n\nconst FindGrantsButton = ({\n files,\n findGrantsCallback,\n}: FindGrantsButtonProps) => {\n const { updateActiveQuery, queryText, closeModal } = useGrantMatchContext();\n\n const onClick = () => {\n if (findGrantsCallback) {\n findGrantsCallback();\n }\n\n updateActiveQuery({ files, text: queryText });\n closeModal();\n };\n\n return (\n <Button\n text=\"Find My Grants\"\n onClick={onClick}\n backgroundColor={Colors.accent.yellow1}\n />\n );\n};\n"]}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type SearchBarProps = {
|
|
2
|
+
textSearchCallback?: () => void;
|
|
3
|
+
openModalCallback?: () => void;
|
|
4
|
+
};
|
|
5
|
+
declare const SearchBar: ({ textSearchCallback, openModalCallback, }: SearchBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
6
|
export default SearchBar;
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import styled, { css } from "styled-components";
|
|
3
3
|
import { Colors, Icons, Responsive, Typography } from "../../foundations";
|
|
4
4
|
import { useGrantMatchContext } from "./context";
|
|
5
|
-
const SearchBar = () => {
|
|
5
|
+
const SearchBar = ({ textSearchCallback, openModalCallback, }) => {
|
|
6
6
|
const { activeQuery, queryText } = useGrantMatchContext();
|
|
7
|
-
return (_jsxs(BaseSearchBar, { "$hasActiveQueryText": activeQuery.text !== "", children: [_jsx(QueryTextInput, {}), _jsxs(Buttons, { children: [queryText !== "" ? _jsx(ResetTextButton, {}) : _jsx(_Fragment, {}), _jsx(
|
|
7
|
+
return (_jsxs(BaseSearchBar, { "$hasActiveQueryText": activeQuery.text !== "", children: [_jsx(QueryTextInput, {}), _jsxs(Buttons, { children: [queryText !== "" ? _jsx(ResetTextButton, {}) : _jsx(_Fragment, {}), _jsx(TextSearchButton, { textSearchCallback: textSearchCallback }), _jsx(OpenModalButton, { openModalCallback: openModalCallback })] })] }));
|
|
8
8
|
};
|
|
9
9
|
export default SearchBar;
|
|
10
10
|
const BaseSearchBar = styled.div `
|
|
@@ -82,20 +82,31 @@ const BaseResetTextButton = styled(BaseIconButton) `
|
|
|
82
82
|
background-color: ${Colors.base.white};
|
|
83
83
|
border: 1px solid ${Colors.base.white};
|
|
84
84
|
`;
|
|
85
|
-
const
|
|
85
|
+
const TextSearchButton = ({ textSearchCallback }) => {
|
|
86
86
|
const { activeQuery, updateActiveQuery, queryText } = useGrantMatchContext();
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
const onClickSearch = () => {
|
|
88
|
+
if (textSearchCallback) {
|
|
89
|
+
textSearchCallback();
|
|
90
|
+
}
|
|
91
|
+
updateActiveQuery({ files: activeQuery.files, text: queryText });
|
|
92
|
+
};
|
|
93
|
+
return (_jsx(BaseSearchButton, { type: "button", onClick: onClickSearch, children: _jsx(Icons.MagnifyingGlassIcon, { size: 16, color: Colors.neutral.grey1 }) }));
|
|
89
94
|
};
|
|
90
95
|
const BaseSearchButton = styled(BaseIconButton) `
|
|
91
96
|
background-color: ${Colors.neutral.grey4};
|
|
92
97
|
border: 1px solid ${Colors.neutral.grey3};
|
|
93
98
|
`;
|
|
94
|
-
const
|
|
99
|
+
const OpenModalButton = ({ openModalCallback }) => {
|
|
95
100
|
const { activeQuery, openModal } = useGrantMatchContext();
|
|
96
|
-
|
|
101
|
+
const onClickOpen = () => {
|
|
102
|
+
if (openModalCallback) {
|
|
103
|
+
openModalCallback();
|
|
104
|
+
}
|
|
105
|
+
openModal();
|
|
106
|
+
};
|
|
107
|
+
return (_jsxs(BaseOpenModalButton, { onClick: onClickOpen, "$hasActiveQueryFiles": activeQuery.files.length > 0, children: [_jsx(Icons.FileArrowUpIcon, { size: 16 }), _jsx(OpenModalButtonText, { children: "File Drop" })] }));
|
|
97
108
|
};
|
|
98
|
-
const
|
|
109
|
+
const BaseOpenModalButton = styled.button `
|
|
99
110
|
display: flex;
|
|
100
111
|
align-items: center;
|
|
101
112
|
justify-content: center;
|
|
@@ -127,7 +138,7 @@ const BaseFileDropButton = styled.button `
|
|
|
127
138
|
font-size: ${Typography.HELPER_FONT_SIZES.big};
|
|
128
139
|
}
|
|
129
140
|
`;
|
|
130
|
-
const
|
|
141
|
+
const OpenModalButtonText = styled.p `
|
|
131
142
|
overflow: hidden;
|
|
132
143
|
white-space: nowrap;
|
|
133
144
|
text-overflow: ellipsis;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/SearchBar.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/SearchBar.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAOjD,MAAM,SAAS,GAAG,CAAC,EAC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,EAAE,EAAE,GAAI,EACnC,KAAC,mBAAmB,4BAAgC,IAChC,CACvB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAmC;;;;;;;;;sBAStD,MAAM,CAAC,IAAI,CAAC,cAAc;;;IAG5C,CAAC,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAC7B,oBAAoB;IAClB,CAAC,CAAC,GAAG,CAAA;8BACmB,MAAM,CAAC,IAAI,CAAC,cAAc;mBACrC,MAAM,CAAC,UAAU,CAAC,SAAS;SACrC;IACH,CAAC,CAAC,GAAG,CAAA;8BACmB,MAAM,CAAC,IAAI,CAAC,KAAK;mBAC5B,MAAM,CAAC,IAAI,CAAC,cAAc;SACpC;;oBAEW,UAAU,CAAC,iBAAiB,CAAC,MAAM;;iBAEtC,UAAU,CAAC,iBAAiB,CAAC,KAAK;;;qBAG9B,UAAU,CAAC,iBAAiB,CAAC,MAAM;;iBAEvC,UAAU,CAAC,iBAAiB,CAAC,GAAG;;CAEhD,CAAC;AAEF,MAAM,mBAAmB,GAAG,MAAM,CAAC,CAAC,CAAA;;;;;oBAKhB,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;qBAIlC,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;CAGvD,CAAC","sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport { Colors, Icons, Responsive, Typography } from \"../../foundations\";\nimport { useGrantMatchContext } from \"./context\";\n\ntype SearchBarProps = {\n textSearchCallback?: () => void;\n openModalCallback?: () => void;\n};\n\nconst SearchBar = ({\n textSearchCallback,\n openModalCallback,\n}: SearchBarProps) => {\n const { activeQuery, queryText } = useGrantMatchContext();\n\n return (\n <BaseSearchBar $hasActiveQueryText={activeQuery.text !== \"\"}>\n <QueryTextInput />\n\n <Buttons>\n {queryText !== \"\" ? <ResetTextButton /> : <></>}\n <TextSearchButton textSearchCallback={textSearchCallback} />\n <OpenModalButton openModalCallback={openModalCallback} />\n </Buttons>\n </BaseSearchBar>\n );\n};\n\nexport default SearchBar;\n\nconst BaseSearchBar = styled.div<{ $hasActiveQueryText: boolean }>`\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n background-color: ${Colors.base.white};\n color: ${Colors.typography.blackHigh};\n\n border: 1px solid\n ${({ $hasActiveQueryText }) =>\n $hasActiveQueryText ? Colors.main.grantbiiOrange : Colors.neutral.grey3};\n border-radius: 12px;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 6px;\n padding: 6px;\n width: 100%;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 10px;\n padding: 10px;\n width: 480px;\n }\n`;\n\nconst QueryTextInput = () => {\n const { activeQuery, updateActiveQuery, queryText, updateQueryText } =\n useGrantMatchContext();\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Enter\" && !event.repeat) {\n event.preventDefault();\n updateActiveQuery({ files: activeQuery.files, text: queryText });\n }\n };\n\n return (\n <BaseQueryTextInput\n value={queryText}\n onChange={(event) => updateQueryText(event.target.value)}\n onKeyDown={onKeyDown}\n placeholder=\"Find grants that match your needs\"\n />\n );\n};\n\nconst BaseQueryTextInput = styled.input`\n border: none;\n outline: none;\n\n width: 100%;\n`;\n\nconst Buttons = styled.div`\n display: flex;\n align-items: center;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 6px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 10px;\n }\n`;\n\nconst BaseIconButton = styled.button`\n display: flex;\n align-items: center;\n justify-content: center;\n\n height: 31px;\n width: 31px;\n min-width: 31px;\n\n border-radius: 8px;\n`;\n\nconst ResetTextButton = () => {\n const { activeQuery, updateActiveQuery, updateQueryText } =\n useGrantMatchContext();\n\n const onClick = () => {\n updateQueryText(\"\");\n updateActiveQuery({ files: activeQuery.files, text: \"\" });\n };\n\n return (\n <BaseResetTextButton type=\"button\" onClick={onClick}>\n <Icons.XIcon size={16} color={Colors.neutral.grey1} />\n </BaseResetTextButton>\n );\n};\n\nconst BaseResetTextButton = styled(BaseIconButton)`\n background-color: ${Colors.base.white};\n border: 1px solid ${Colors.base.white};\n`;\n\ntype TextSearchButtonProps = {\n textSearchCallback?: () => void;\n};\n\nconst TextSearchButton = ({ textSearchCallback }: TextSearchButtonProps) => {\n const { activeQuery, updateActiveQuery, queryText } = useGrantMatchContext();\n\n const onClickSearch = () => {\n if (textSearchCallback) {\n textSearchCallback();\n }\n\n updateActiveQuery({ files: activeQuery.files, text: queryText });\n };\n\n return (\n <BaseSearchButton type=\"button\" onClick={onClickSearch}>\n <Icons.MagnifyingGlassIcon size={16} color={Colors.neutral.grey1} />\n </BaseSearchButton>\n );\n};\n\nconst BaseSearchButton = styled(BaseIconButton)`\n background-color: ${Colors.neutral.grey4};\n border: 1px solid ${Colors.neutral.grey3};\n`;\n\ntype OpenModalButtonProps = {\n openModalCallback?: () => void;\n};\n\nconst OpenModalButton = ({ openModalCallback }: OpenModalButtonProps) => {\n const { activeQuery, openModal } = useGrantMatchContext();\n\n const onClickOpen = () => {\n if (openModalCallback) {\n openModalCallback();\n }\n\n openModal();\n };\n\n return (\n <BaseOpenModalButton\n onClick={onClickOpen}\n $hasActiveQueryFiles={activeQuery.files.length > 0}\n >\n <Icons.FileArrowUpIcon size={16} />\n <OpenModalButtonText>File Drop</OpenModalButtonText>\n </BaseOpenModalButton>\n );\n};\n\nconst BaseOpenModalButton = styled.button<{ $hasActiveQueryFiles: boolean }>`\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 4px;\n\n height: 31px;\n min-width: 31px;\n\n border: 1px solid ${Colors.main.grantbiiOrange};\n border-radius: 8px;\n\n ${({ $hasActiveQueryFiles }) =>\n $hasActiveQueryFiles\n ? css`\n background-color: ${Colors.main.grantbiiOrange};\n color: ${Colors.typography.whiteHigh};\n `\n : css`\n background-color: ${Colors.base.white};\n color: ${Colors.main.grantbiiOrange};\n `}\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n padding: 0px;\n font-size: ${Typography.HELPER_FONT_SIZES.small};\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n padding: 0px 8px;\n font-size: ${Typography.HELPER_FONT_SIZES.big};\n }\n`;\n\nconst OpenModalButtonText = styled.p`\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n display: none;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n display: inline;\n }\n`;\n"]}
|
|
@@ -2,7 +2,11 @@ import type { GrantMatchQuery } from "@grantbii/ui-core/match/models";
|
|
|
2
2
|
type GrantMatchProps = {
|
|
3
3
|
activeQuery: GrantMatchQuery;
|
|
4
4
|
updateActiveQuery: (newQuery: GrantMatchQuery) => void;
|
|
5
|
+
textSearchCallback?: () => void;
|
|
6
|
+
findGrantsCallback?: () => void;
|
|
7
|
+
closeModalCallback?: () => void;
|
|
8
|
+
openModalCallback?: () => void;
|
|
5
9
|
};
|
|
6
|
-
declare const GrantMatch: ({ activeQuery, updateActiveQuery }: GrantMatchProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const GrantMatch: ({ activeQuery, updateActiveQuery, textSearchCallback, findGrantsCallback, closeModalCallback, openModalCallback, }: GrantMatchProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
11
|
export default GrantMatch;
|
|
8
12
|
export declare const useGrantMatchActiveQuery: (performGrantMatch: (newQuery: GrantMatchQuery) => void, resetGrantMatch: () => void) => GrantMatchProps;
|
|
@@ -7,10 +7,11 @@ import ActiveQueryFiles from "./ActiveQueryFiles";
|
|
|
7
7
|
import GrantMatchModal from "./GrantMatchModal";
|
|
8
8
|
import SearchBar from "./SearchBar";
|
|
9
9
|
import { GrantMatchContext } from "./context";
|
|
10
|
-
const GrantMatch = ({ activeQuery, updateActiveQuery }) => {
|
|
10
|
+
const GrantMatch = ({ activeQuery, updateActiveQuery, textSearchCallback, findGrantsCallback, closeModalCallback, openModalCallback, }) => {
|
|
11
11
|
const { showModal, openModal, closeModal } = useModal();
|
|
12
12
|
const [queryText, setQueryText] = useState(activeQuery.text);
|
|
13
13
|
const updateQueryText = (newText) => setQueryText(newText);
|
|
14
|
+
// TODO: refactor away?
|
|
14
15
|
const commonProps = {
|
|
15
16
|
activeQuery,
|
|
16
17
|
updateActiveQuery,
|
|
@@ -19,7 +20,7 @@ const GrantMatch = ({ activeQuery, updateActiveQuery }) => {
|
|
|
19
20
|
openModal,
|
|
20
21
|
closeModal,
|
|
21
22
|
};
|
|
22
|
-
return (_jsx(GrantMatchContext.Provider, { value: commonProps, children: _jsxs(BaseGrantMatch, { children: [_jsx(SearchBar, {}), activeQuery.files.length > 0 ? _jsx(ActiveQueryFiles, {}) : _jsx(_Fragment, {}), showModal ? _jsx(GrantMatchModal, {}) : _jsx(_Fragment, {})] }) }));
|
|
23
|
+
return (_jsx(GrantMatchContext.Provider, { value: commonProps, children: _jsxs(BaseGrantMatch, { children: [_jsx(SearchBar, { textSearchCallback: textSearchCallback, openModalCallback: openModalCallback }), activeQuery.files.length > 0 ? _jsx(ActiveQueryFiles, {}) : _jsx(_Fragment, {}), showModal ? (_jsx(GrantMatchModal, { findGrantsCallback: findGrantsCallback, closeModalCallback: closeModalCallback })) : (_jsx(_Fragment, {}))] }) }));
|
|
23
24
|
};
|
|
24
25
|
export default GrantMatch;
|
|
25
26
|
const BaseGrantMatch = styled.div `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACv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,WAAW,YAC5C,MAAC,cAAc,eACb,KAAC,SAAS,IACR,kBAAkB,EAAE,kBAAkB,EACtC,iBAAiB,EAAE,iBAAiB,GACpC,EACD,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAC,gBAAgB,KAAG,CAAC,CAAC,CAAC,mBAAK,EAC3D,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,eAAe,IACd,kBAAkB,EAAE,kBAAkB,EACtC,kBAAkB,EAAE,kBAAkB,GACtC,CACH,CAAC,CAAC,CAAC,CACF,mBAAK,CACN,IACc,GACU,CAC9B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC;AAE1B,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;CAOhC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,iBAAsD,EACtD,eAA2B,EACV,EAAE;IACnB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAkB;QAC9D,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,EAAE;KACT,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,CAAC,QAAyB,EAAE,EAAE;QACtD,cAAc,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC,CAAC;QAEhC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,eAAe,EAAE,CAAC;QACpB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAC5C,CAAC,CAAC","sourcesContent":["import type { GrantMatchQuery } from \"@grantbii/ui-core/match/models\";\nimport { checkGrantMatchActive } from \"@grantbii/ui-core/match/validations\";\nimport { useState } from \"react\";\nimport styled from \"styled-components\";\nimport { useModal } from \"../../molecules\";\nimport ActiveQueryFiles from \"./ActiveQueryFiles\";\nimport GrantMatchModal from \"./GrantMatchModal\";\nimport SearchBar from \"./SearchBar\";\nimport { GrantMatchContext } from \"./context\";\n\ntype GrantMatchProps = {\n activeQuery: GrantMatchQuery;\n updateActiveQuery: (newQuery: GrantMatchQuery) => void;\n textSearchCallback?: () => void;\n findGrantsCallback?: () => void;\n closeModalCallback?: () => void;\n openModalCallback?: () => void;\n};\n\nconst GrantMatch = ({\n activeQuery,\n updateActiveQuery,\n textSearchCallback,\n findGrantsCallback,\n closeModalCallback,\n openModalCallback,\n}: GrantMatchProps) => {\n const { showModal, openModal, closeModal } = useModal();\n const [queryText, setQueryText] = useState(activeQuery.text);\n const updateQueryText = (newText: string) => setQueryText(newText);\n\n // TODO: refactor away?\n const commonProps = {\n activeQuery,\n updateActiveQuery,\n queryText,\n updateQueryText,\n openModal,\n closeModal,\n };\n\n return (\n <GrantMatchContext.Provider value={commonProps}>\n <BaseGrantMatch>\n <SearchBar\n textSearchCallback={textSearchCallback}\n openModalCallback={openModalCallback}\n />\n {activeQuery.files.length > 0 ? <ActiveQueryFiles /> : <></>}\n {showModal ? (\n <GrantMatchModal\n findGrantsCallback={findGrantsCallback}\n closeModalCallback={closeModalCallback}\n />\n ) : (\n <></>\n )}\n </BaseGrantMatch>\n </GrantMatchContext.Provider>\n );\n};\n\nexport default GrantMatch;\n\nconst BaseGrantMatch = styled.div`\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n width: 100%;\n max-width: 100vw;\n`;\n\nexport const useGrantMatchActiveQuery = (\n performGrantMatch: (newQuery: GrantMatchQuery) => void,\n resetGrantMatch: () => void,\n): GrantMatchProps => {\n const [activeQuery, setActiveQuery] = useState<GrantMatchQuery>({\n files: [],\n text: \"\",\n });\n\n const updateActiveQuery = (newQuery: GrantMatchQuery) => {\n setActiveQuery({ ...newQuery });\n\n if (checkGrantMatchActive(newQuery)) {\n performGrantMatch(newQuery);\n } else {\n resetGrantMatch();\n }\n };\n\n return { activeQuery, updateActiveQuery };\n};\n"]}
|
|
@@ -3,7 +3,7 @@ type TallyModalProps = {
|
|
|
3
3
|
header?: ReactNode;
|
|
4
4
|
tallyId: string;
|
|
5
5
|
prefilledFieldsQueryParams?: string;
|
|
6
|
-
|
|
6
|
+
onClickClose: MouseEventHandler<HTMLButtonElement>;
|
|
7
7
|
};
|
|
8
8
|
declare const TallyModal: ({ tallyId, prefilledFieldsQueryParams, ...modalProps }: TallyModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export default TallyModal;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Modal } from "../molecules";
|
|
3
|
-
const TallyModal = ({ tallyId, prefilledFieldsQueryParams, ...modalProps }) => (_jsx(Modal, { ...modalProps, content: _jsx("iframe", { src: constructIframeSrc(tallyId, prefilledFieldsQueryParams), loading: "lazy" }), width: "640px", height: "
|
|
3
|
+
const TallyModal = ({ tallyId, prefilledFieldsQueryParams, ...modalProps }) => (_jsx(Modal, { ...modalProps, content: _jsx("iframe", { src: constructIframeSrc(tallyId, prefilledFieldsQueryParams), loading: "lazy" }), width: "640px", height: "600px" }));
|
|
4
4
|
export default TallyModal;
|
|
5
5
|
const constructIframeSrc = (tallyId, prefilledFieldsQueryParams) => `https://tally.so/embed/${tallyId}?${TALLY_QUERIES}${prefilledFieldsQueryParams ? `&${prefilledFieldsQueryParams}` : ""}`;
|
|
6
6
|
const TALLY_QUERIES = "alignLeft=1&hideTitle=1&transparentBackground=1&dynamicHeight=0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TallyModal.js","sourceRoot":"","sources":["../../../core/organisms/TallyModal.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AASrC,MAAM,UAAU,GAAG,CAAC,EAClB,OAAO,EACP,0BAA0B,EAC1B,GAAG,UAAU,EACG,EAAE,EAAE,CAAC,CACrB,KAAC,KAAK,OACA,UAAU,EACd,OAAO,EACL,iBACE,GAAG,EAAE,kBAAkB,CAAC,OAAO,EAAE,0BAA0B,CAAC,EAC5D,OAAO,EAAC,MAAM,GACd,EAEJ,KAAK,EAAC,OAAO,EACb,MAAM,EAAC,OAAO,GACd,CACH,CAAC;AAEF,eAAe,UAAU,CAAC;AAE1B,MAAM,kBAAkB,GAAG,CACzB,OAAe,EACf,0BAAmC,EACnC,EAAE,CACF,0BAA0B,OAAO,IAAI,aAAa,GAAG,0BAA0B,CAAC,CAAC,CAAC,IAAI,0BAA0B,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAE5H,MAAM,aAAa,GACjB,iEAAiE,CAAC","sourcesContent":["import type { MouseEventHandler, ReactNode } from \"react\";\nimport { Modal } from \"../molecules\";\n\ntype TallyModalProps = {\n header?: ReactNode;\n tallyId: string;\n prefilledFieldsQueryParams?: string;\n
|
|
1
|
+
{"version":3,"file":"TallyModal.js","sourceRoot":"","sources":["../../../core/organisms/TallyModal.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AASrC,MAAM,UAAU,GAAG,CAAC,EAClB,OAAO,EACP,0BAA0B,EAC1B,GAAG,UAAU,EACG,EAAE,EAAE,CAAC,CACrB,KAAC,KAAK,OACA,UAAU,EACd,OAAO,EACL,iBACE,GAAG,EAAE,kBAAkB,CAAC,OAAO,EAAE,0BAA0B,CAAC,EAC5D,OAAO,EAAC,MAAM,GACd,EAEJ,KAAK,EAAC,OAAO,EACb,MAAM,EAAC,OAAO,GACd,CACH,CAAC;AAEF,eAAe,UAAU,CAAC;AAE1B,MAAM,kBAAkB,GAAG,CACzB,OAAe,EACf,0BAAmC,EACnC,EAAE,CACF,0BAA0B,OAAO,IAAI,aAAa,GAAG,0BAA0B,CAAC,CAAC,CAAC,IAAI,0BAA0B,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAE5H,MAAM,aAAa,GACjB,iEAAiE,CAAC","sourcesContent":["import type { MouseEventHandler, ReactNode } from \"react\";\nimport { Modal } from \"../molecules\";\n\ntype TallyModalProps = {\n header?: ReactNode;\n tallyId: string;\n prefilledFieldsQueryParams?: string;\n onClickClose: MouseEventHandler<HTMLButtonElement>;\n};\n\nconst TallyModal = ({\n tallyId,\n prefilledFieldsQueryParams,\n ...modalProps\n}: TallyModalProps) => (\n <Modal\n {...modalProps}\n content={\n <iframe\n src={constructIframeSrc(tallyId, prefilledFieldsQueryParams)}\n loading=\"lazy\"\n />\n }\n width=\"640px\"\n height=\"600px\"\n />\n);\n\nexport default TallyModal;\n\nconst constructIframeSrc = (\n tallyId: string,\n prefilledFieldsQueryParams?: string,\n) =>\n `https://tally.so/embed/${tallyId}?${TALLY_QUERIES}${prefilledFieldsQueryParams ? `&${prefilledFieldsQueryParams}` : \"\"}`;\n\nconst TALLY_QUERIES =\n \"alignLeft=1&hideTitle=1&transparentBackground=1&dynamicHeight=0\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grantbii/design-system",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "Grantbii's Design System",
|
|
5
5
|
"homepage": "https://design.grantbii.com",
|
|
6
6
|
"repository": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"@chromatic-com/storybook": "4.1.1",
|
|
34
34
|
"@eslint/js": "9.35.0",
|
|
35
35
|
"@next/eslint-plugin-next": "15.5.3",
|
|
36
|
-
"@storybook/addon-a11y": "9.1.
|
|
37
|
-
"@storybook/addon-docs": "9.1.
|
|
38
|
-
"@storybook/addon-onboarding": "9.1.
|
|
39
|
-
"@storybook/addon-vitest": "9.1.
|
|
40
|
-
"@storybook/nextjs-vite": "9.1.
|
|
36
|
+
"@storybook/addon-a11y": "9.1.6",
|
|
37
|
+
"@storybook/addon-docs": "9.1.6",
|
|
38
|
+
"@storybook/addon-onboarding": "9.1.6",
|
|
39
|
+
"@storybook/addon-vitest": "9.1.6",
|
|
40
|
+
"@storybook/nextjs-vite": "9.1.6",
|
|
41
41
|
"@types/node": "22.18.0",
|
|
42
42
|
"@types/react": "19.1.12",
|
|
43
43
|
"@types/react-dom": "19.1.9",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"@vitest/coverage-v8": "3.2.4",
|
|
46
46
|
"eslint": "9.35.0",
|
|
47
47
|
"eslint-config-next": "15.5.3",
|
|
48
|
-
"eslint-plugin-storybook": "9.1.
|
|
48
|
+
"eslint-plugin-storybook": "9.1.6",
|
|
49
49
|
"husky": "9.1.7",
|
|
50
50
|
"lint-staged": "16.1.6",
|
|
51
51
|
"playwright": "1.55.0",
|
|
52
52
|
"prettier": "3.6.2",
|
|
53
|
-
"storybook": "9.1.
|
|
53
|
+
"storybook": "9.1.6",
|
|
54
54
|
"typescript": "5.9.2",
|
|
55
55
|
"vitest": "3.2.4"
|
|
56
56
|
},
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { Button, Modal, useModal } from "@/.";
|
|
3
3
|
const ModalExample = (props) => {
|
|
4
4
|
const { showModal, openModal, closeModal } = useModal();
|
|
5
|
-
return (_jsxs("div", { children: [_jsx(Button, { text: "Click to open modal", onClick: () => openModal() }), showModal ? (_jsx(Modal, { ...props,
|
|
5
|
+
return (_jsxs("div", { children: [_jsx(Button, { text: "Click to open modal", onClick: () => openModal() }), showModal ? (_jsx(Modal, { ...props, onClickClose: () => closeModal() })) : (_jsx(_Fragment, {}))] }));
|
|
6
6
|
};
|
|
7
7
|
const meta = {
|
|
8
8
|
title: "Molecules/Modal",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.stories.js","sourceRoot":"","sources":["../../../stories/molecules/Modal.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CA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Y,GAAG,CACnB,gFAA4D,CAC7D,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,IAAI,EAAE;QACJ,GAAG,QAAQ;QACX,OAAO,EAAE,YAAY;KACtB;CACF,CAAC;AAEF,MAAM,WAAW,GAAG,CAClB,0BACE,qdAQI,EAEJ,+NAII,EAEJ,iOAII,IACA,CACP,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAU;IAChC,IAAI,EAAE;QACJ,GAAG,QAAQ;QACX,OAAO,EAAE,WAAW;KACrB;CACF,CAAC","sourcesContent":["import { Button, Modal, useModal } from \"@/.\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\nimport type { JSX, ReactNode } from \"react\";\n\ntype ModalExampleProps = {\n header?: ReactNode;\n content: JSX.Element;\n footer?: ReactNode;\n width?: string;\n height?: string;\n};\n\nconst ModalExample = (props: ModalExampleProps) => {\n const { showModal, openModal, closeModal } = useModal();\n\n return (\n <div>\n <Button text=\"Click to open modal\" onClick={() => openModal()} />\n\n {showModal ? (\n <Modal {...props} onClickClose={() => closeModal()} />\n ) : (\n <></>\n )}\n </div>\n );\n};\n\nconst meta: Meta<typeof ModalExample> = {\n title: \"Molecules/Modal\",\n component: ModalExample,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"centered\",\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nconst baseArgs = {\n header: \"Grantbii\",\n width: \"600px\",\n height: \"360px\",\n};\n\nconst shortContent = (\n <p>Amplifying Business Grant Impact for SMEs & Scale-ups</p>\n);\n\nexport const ShortContent: Story = {\n args: {\n ...baseArgs,\n content: shortContent,\n },\n};\n\nconst longContent = (\n <div>\n <p>\n Grantbii is an AI-powered grant intelligence and matching platform that\n helps grant seekers effortlessly find, match, prep & apply for the right\n business grants - maximizing grant funding success with minimal effort.\n Our platform connects businesses with a trusted Grant Enabler Network -\n solution providers, consulting experts, and delivery partners - ensuring\n that every dollar of grant funding leads to real business transformation\n impact.\n </p>\n\n <p>\n In the future, Grantbii aims to automate the entire grant application\n lifecycle, from discovery to claims submission and guide you through the\n application process with minimal effort on your part.\n </p>\n\n <p>\n To maximize your chances of grant success, you can expect to leverage on\n tools to assess your chances of success and offer expert support to ensure\n your application meets all necessary requirements.\n </p>\n </div>\n);\n\nexport const LongContent: Story = {\n args: {\n ...baseArgs,\n content: longContent,\n },\n};\n"]}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/nextjs-vite";
|
|
2
|
-
|
|
2
|
+
type Callbacks = {
|
|
3
|
+
textSearchCallback?: () => void;
|
|
4
|
+
findGrantsCallback?: () => void;
|
|
5
|
+
closeModalCallback?: () => void;
|
|
6
|
+
openModalCallback?: () => void;
|
|
7
|
+
};
|
|
8
|
+
declare const GrantMatchExample: (callbacks: Callbacks) => import("react/jsx-runtime").JSX.Element;
|
|
3
9
|
declare const meta: Meta<typeof GrantMatchExample>;
|
|
4
10
|
export default meta;
|
|
5
11
|
type Story = StoryObj<typeof meta>;
|
|
6
|
-
export declare const
|
|
12
|
+
export declare const DefaultExample: Story;
|
|
13
|
+
export declare const WithCallbacks: Story;
|
|
@@ -4,7 +4,7 @@ import { useGrantMatchActiveQuery } from "@/core/organisms/GrantMatch";
|
|
|
4
4
|
import {} from "@grantbii/ui-core/match/models";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import styled from "styled-components";
|
|
7
|
-
const GrantMatchExample = () => {
|
|
7
|
+
const GrantMatchExample = (callbacks) => {
|
|
8
8
|
const [status, setStatus] = useState("pending query");
|
|
9
9
|
const performGrantMatch = (newQuery) => {
|
|
10
10
|
const fileNames = newQuery.files.map((file) => file.name).join(", ");
|
|
@@ -14,7 +14,7 @@ const GrantMatchExample = () => {
|
|
|
14
14
|
};
|
|
15
15
|
const resetGrantMatch = () => setStatus("pending query");
|
|
16
16
|
const grantMatchQueryProps = useGrantMatchActiveQuery(performGrantMatch, resetGrantMatch);
|
|
17
|
-
return (_jsxs(Container, { children: [_jsx(GrantMatch, { ...grantMatchQueryProps }), _jsxs("p", { children: ["Status: ", status] })] }));
|
|
17
|
+
return (_jsxs(Container, { children: [_jsx(GrantMatch, { ...grantMatchQueryProps, ...callbacks }), _jsxs("p", { children: ["Status: ", status] })] }));
|
|
18
18
|
};
|
|
19
19
|
const Container = styled.div `
|
|
20
20
|
display: flex;
|
|
@@ -32,7 +32,15 @@ const meta = {
|
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
34
|
export default meta;
|
|
35
|
-
export const
|
|
35
|
+
export const DefaultExample = {
|
|
36
36
|
args: {},
|
|
37
37
|
};
|
|
38
|
+
export const WithCallbacks = {
|
|
39
|
+
args: {
|
|
40
|
+
textSearchCallback: () => alert("doing text search"),
|
|
41
|
+
findGrantsCallback: () => alert("finding your grants"),
|
|
42
|
+
closeModalCallback: () => alert("closing modal"),
|
|
43
|
+
openModalCallback: () => alert("opening modal"),
|
|
44
|
+
},
|
|
45
|
+
};
|
|
38
46
|
//# sourceMappingURL=GrantMatch.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrantMatch.stories.js","sourceRoot":"","sources":["../../../stories/organisms/GrantMatch.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAwB,MAAM,gCAAgC,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"GrantMatch.stories.js","sourceRoot":"","sources":["../../../stories/organisms/GrantMatch.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAwB,MAAM,gCAA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IpB,MAAM,CAAC,MAAM,cAAc,GAAU;IACnC,IAAI,EAAE,EAAE;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAU;IAClC,IAAI,EAAE;QACJ,kBAAkB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC;QACpD,kBAAkB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,qBAAqB,CAAC;QACtD,kBAAkB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC;QAChD,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC;KAChD;CACF,CAAC","sourcesContent":["import { GrantMatch } from \"@/.\";\nimport { useGrantMatchActiveQuery } from \"@/core/organisms/GrantMatch\";\nimport { type GrantMatchQuery } from \"@grantbii/ui-core/match/models\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\nimport { useState } from \"react\";\nimport styled from \"styled-components\";\n\ntype Callbacks = {\n textSearchCallback?: () => void;\n findGrantsCallback?: () => void;\n closeModalCallback?: () => void;\n openModalCallback?: () => void;\n};\n\nconst GrantMatchExample = (callbacks: Callbacks) => {\n const [status, setStatus] = useState(\"pending query\");\n\n const performGrantMatch = (newQuery: GrantMatchQuery) => {\n const fileNames = newQuery.files.map((file) => file.name).join(\", \");\n const printableQuery = `files [${fileNames}] and text [${newQuery.text}]`;\n\n setStatus(`trying to find grants using ${printableQuery}`);\n setTimeout(() => setStatus(`found grants with ${printableQuery}`), 1000);\n };\n\n const resetGrantMatch = () => setStatus(\"pending query\");\n\n const grantMatchQueryProps = useGrantMatchActiveQuery(\n performGrantMatch,\n resetGrantMatch,\n );\n\n return (\n <Container>\n <GrantMatch {...grantMatchQueryProps} {...callbacks} />\n <p>Status: {status}</p>\n </Container>\n );\n};\n\nconst Container = styled.div`\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n padding: 16px;\n`;\n\nconst meta: Meta<typeof GrantMatchExample> = {\n title: \"Organisms/Grant Match\",\n component: GrantMatchExample,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"fullscreen\",\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const DefaultExample: Story = {\n args: {},\n};\n\nexport const WithCallbacks: Story = {\n args: {\n textSearchCallback: () => alert(\"doing text search\"),\n findGrantsCallback: () => alert(\"finding your grants\"),\n closeModalCallback: () => alert(\"closing modal\"),\n openModalCallback: () => alert(\"opening modal\"),\n },\n};\n"]}
|
|
@@ -3,7 +3,7 @@ import { Button, TallyModal, useModal } from "@/.";
|
|
|
3
3
|
import {} from "react";
|
|
4
4
|
const TallyModalExample = (props) => {
|
|
5
5
|
const { showModal, openModal, closeModal } = useModal();
|
|
6
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { text: "Click to open modal", onClick: () => openModal() }), showModal ? (_jsx(TallyModal, { ...props,
|
|
6
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { text: "Click to open modal", onClick: () => openModal() }), showModal ? (_jsx(TallyModal, { ...props, onClickClose: () => closeModal() })) : (_jsx(_Fragment, {}))] }));
|
|
7
7
|
};
|
|
8
8
|
const meta = {
|
|
9
9
|
title: "Organisms/Tally Modal",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TallyModal.stories.js","sourceRoot":"","sources":["../../../stories/organisms/TallyModal.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEnD,OAAO,EAAkB,MAAM,OAAO,CAAC;AAQvC,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAE,EAAE;IAC1D,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,QAAQ,EAAE,CAAC;IAExD,OAAO,CACL,8BACE,KAAC,MAAM,IAAC,IAAI,EAAC,qBAAqB,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,GAAI,EAChE,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,UAAU,OAAK,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"TallyModal.stories.js","sourceRoot":"","sources":["../../../stories/organisms/TallyModal.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEnD,OAAO,EAAkB,MAAM,OAAO,CAAC;AAQvC,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAE,EAAE;IAC1D,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,QAAQ,EAAE,CAAC;IAExD,OAAO,CACL,8BACE,KAAC,MAAM,IAAC,IAAI,EAAC,qBAAqB,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,GAAI,EAChE,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,UAAU,OAAK,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,GAAI,CAC5D,CAAC,CAAC,CAAC,CACF,mBAAK,CACN,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,IAAI,GAAmC;IAC3C,KAAK,EAAE,uBAAuB;IAC9B,SAAS,EAAE,iBAAiB;IAC5B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,MAAM,EAAE,eAAe;QACvB,OAAO,EAAE,QAAQ;KAClB;CACF,CAAC","sourcesContent":["import { Button, TallyModal, useModal } from \"@/.\";\nimport type { Meta, StoryObj } from \"@storybook/nextjs-vite\";\nimport { type ReactNode } from \"react\";\n\ntype TallyModalExampleProps = {\n header?: ReactNode;\n tallyId: string;\n prefilledFieldsQueryParams?: string;\n};\n\nconst TallyModalExample = (props: TallyModalExampleProps) => {\n const { showModal, openModal, closeModal } = useModal();\n\n return (\n <>\n <Button text=\"Click to open modal\" onClick={() => openModal()} />\n {showModal ? (\n <TallyModal {...props} onClickClose={() => closeModal()} />\n ) : (\n <></>\n )}\n </>\n );\n};\n\nconst meta: Meta<typeof TallyModalExample> = {\n title: \"Organisms/Tally Modal\",\n component: TallyModalExample,\n tags: [\"autodocs\"],\n parameters: {\n layout: \"centered\",\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Example: Story = {\n args: {\n header: \"Apply with us\",\n tallyId: \"3jAj5Q\",\n },\n};\n"]}
|