@grantbii/design-system 1.27.0 → 1.28.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.
- package/core/archive/RadioButtons.js +1 -1
- package/core/archive/RadioButtons.js.map +1 -1
- package/core/archive/TallyModal.d.ts +1 -1
- package/core/archive/TallyModal.js +39 -5
- package/core/archive/TallyModal.js.map +1 -1
- package/core/atoms/Color.d.ts +7 -41
- package/core/atoms/Color.js +0 -6
- package/core/atoms/Color.js.map +1 -1
- package/core/atoms/Typography.js +0 -4
- package/core/atoms/Typography.js.map +1 -1
- package/core/organisms/Modal.d.ts +4 -9
- package/core/organisms/Modal.js +11 -44
- package/core/organisms/Modal.js.map +1 -1
- package/core/templates/GrantMatch/GrantMatchModal.js +49 -22
- package/core/templates/GrantMatch/GrantMatchModal.js.map +1 -1
- package/core/templates/GrantMatch/index.js +5 -13
- package/core/templates/GrantMatch/index.js.map +1 -1
- package/package.json +5 -5
- package/stories/archive/TallyModal.stories.js +2 -2
- package/stories/archive/TallyModal.stories.js.map +1 -1
- package/stories/organisms/Modal.stories.d.ts +5 -8
- package/stories/organisms/Modal.stories.js +30 -17
- package/stories/organisms/Modal.stories.js.map +1 -1
- package/stories/templates/GrantMatch.stories.js +0 -3
- package/stories/templates/GrantMatch.stories.js.map +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createElement as _createElement } from "react";
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
import { RadioButton } from "../molecules";
|
|
5
|
-
const RadioButtons = ({ name, options }) => (_jsx(RadioGroup, { children: options.map(({
|
|
5
|
+
const RadioButtons = ({ name, options }) => (_jsx(RadioGroup, { children: options.map(({ value, ...props }) => (_createElement(RadioButton, { ...props, key: `${name}-${value}`, value: value, name: name }))) }));
|
|
6
6
|
export default RadioButtons;
|
|
7
7
|
const RadioGroup = styled.div `
|
|
8
8
|
display: flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButtons.js","sourceRoot":"","sources":["../../../core/archive/RadioButtons.tsx"],"names":[],"mappings":";;AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAW3C,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAoB,EAAE,EAAE,CAAC,CAC5D,KAAC,UAAU,cACR,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"RadioButtons.js","sourceRoot":"","sources":["../../../core/archive/RadioButtons.tsx"],"names":[],"mappings":";;AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAW3C,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAoB,EAAE,EAAE,CAAC,CAC5D,KAAC,UAAU,cACR,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,CAAC,CACpC,eAAC,WAAW,OACN,KAAK,EACT,GAAG,EAAE,GAAG,IAAI,IAAI,KAAK,EAAE,EACvB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,GACV,CACH,CAAC,GACS,CACd,CAAC;AAEF,eAAe,YAAY,CAAC;AAE5B,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;CAO5B,CAAC","sourcesContent":["import type { DetailedHTMLProps, InputHTMLAttributes } from \"react\";\nimport styled from \"styled-components\";\nimport { RadioButton } from \"../molecules\";\nimport type { Option } from \"../types\";\n\nexport type RadioOption = Option &\n DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;\n\ntype RadioButtonProps = {\n name?: string;\n options: RadioOption[];\n};\n\nconst RadioButtons = ({ name, options }: RadioButtonProps) => (\n <RadioGroup>\n {options.map(({ value, ...props }) => (\n <RadioButton\n {...props}\n key={`${name}-${value}`}\n value={value}\n name={name}\n />\n ))}\n </RadioGroup>\n);\n\nexport default RadioButtons;\n\nconst RadioGroup = styled.div`\n display: flex;\n align-items: center;\n gap: 12px;\n\n white-space: nowrap;\n flex-wrap: wrap;\n`;\n"]}
|
|
@@ -5,5 +5,5 @@ type TallyModalProps = {
|
|
|
5
5
|
prefilledFieldsQueryParams?: string;
|
|
6
6
|
onClickClose: MouseEventHandler<HTMLButtonElement>;
|
|
7
7
|
};
|
|
8
|
-
declare const TallyModal: ({ tallyId, prefilledFieldsQueryParams,
|
|
8
|
+
declare const TallyModal: ({ header, tallyId, prefilledFieldsQueryParams, onClickClose, }: TallyModalProps) => import("react").JSX.Element;
|
|
9
9
|
export default TallyModal;
|
|
@@ -1,12 +1,46 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { Color, Spacing, Typography } from "../atoms";
|
|
4
|
+
import { applyTypography } from "../integrations";
|
|
5
|
+
import { Button } from "../molecules";
|
|
6
|
+
import { Modal } from "../organisms";
|
|
7
|
+
const TallyModal = ({ header, tallyId, prefilledFieldsQueryParams, onClickClose, }) => (_jsxs(Modal, { width: "640px", height: "600px", children: [header ? _jsx(ModalHeader, { children: header }) : _jsx(_Fragment, {}), _jsx(ModalBody, { children: _jsx(ModalIframe, { src: constructIframeSrc(tallyId, prefilledFieldsQueryParams), loading: "lazy", title: "Tally Modal" }) }), _jsx(ModalFooter, { children: _jsx(Button, { label: "Close", onClick: onClickClose, variant: "tertiary", size: "small" }) })] }));
|
|
4
8
|
export default TallyModal;
|
|
9
|
+
const ModalHeader = styled.div `
|
|
10
|
+
margin-bottom: ${Spacing.px12};
|
|
11
|
+
padding: ${Spacing.px12} ${Spacing.px20};
|
|
12
|
+
|
|
13
|
+
border-bottom: 1px solid ${Color.neutral.grey3};
|
|
14
|
+
|
|
15
|
+
${applyTypography(Typography.subheading2Medium)}
|
|
16
|
+
`;
|
|
17
|
+
const ModalBody = styled.div `
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
height: 100%;
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
`;
|
|
24
|
+
const ModalIframe = styled.iframe `
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
min-height: ${Spacing.px100};
|
|
28
|
+
|
|
29
|
+
padding: ${Spacing.px4} ${Spacing.px20};
|
|
30
|
+
border: none;
|
|
31
|
+
`;
|
|
32
|
+
const ModalFooter = styled.div `
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
gap: ${Spacing.px12};
|
|
36
|
+
|
|
37
|
+
padding: ${Spacing.px16} ${Spacing.px20};
|
|
38
|
+
`;
|
|
5
39
|
const constructIframeSrc = (tallyId, prefilledFieldsQueryParams) => {
|
|
6
40
|
const queryParams = prefilledFieldsQueryParams
|
|
7
41
|
? `&${prefilledFieldsQueryParams}`
|
|
8
42
|
: "";
|
|
9
|
-
return `https://tally.so/embed/${tallyId}?${
|
|
43
|
+
return `https://tally.so/embed/${tallyId}?${tallyQueryParams}${queryParams}`;
|
|
10
44
|
};
|
|
11
|
-
const
|
|
45
|
+
const tallyQueryParams = "alignLeft=1&hideTitle=1&transparentBackground=1&dynamicHeight=0";
|
|
12
46
|
//# sourceMappingURL=TallyModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TallyModal.js","sourceRoot":"","sources":["../../../core/archive/TallyModal.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"TallyModal.js","sourceRoot":"","sources":["../../../core/archive/TallyModal.tsx"],"names":[],"mappings":";AACA,OAAO,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AO,CAAC,IAAI;;CAEvC,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;SAGrB,OAAO,CAAC,IAAI;;aAER,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI;CACxC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CACzB,OAAe,EACf,0BAAmC,EACnC,EAAE;IACF,MAAM,WAAW,GAAG,0BAA0B;QAC5C,CAAC,CAAC,IAAI,0BAA0B,EAAE;QAClC,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,0BAA0B,OAAO,IAAI,gBAAgB,GAAG,WAAW,EAAE,CAAC;AAC/E,CAAC,CAAC;AAEF,MAAM,gBAAgB,GACpB,iEAAiE,CAAC","sourcesContent":["import type { MouseEventHandler, ReactNode } from \"react\";\nimport styled from \"styled-components\";\nimport { Color, Spacing, Typography } from \"../atoms\";\nimport { applyTypography } from \"../integrations\";\nimport { Button } from \"../molecules\";\nimport { Modal } from \"../organisms\";\n\ntype TallyModalProps = {\n header?: ReactNode;\n tallyId: string;\n prefilledFieldsQueryParams?: string;\n onClickClose: MouseEventHandler<HTMLButtonElement>;\n};\n\nconst TallyModal = ({\n header,\n tallyId,\n prefilledFieldsQueryParams,\n onClickClose,\n}: TallyModalProps) => (\n <Modal width=\"640px\" height=\"600px\">\n {header ? <ModalHeader>{header}</ModalHeader> : <></>}\n\n <ModalBody>\n <ModalIframe\n src={constructIframeSrc(tallyId, prefilledFieldsQueryParams)}\n loading=\"lazy\"\n title=\"Tally Modal\"\n />\n </ModalBody>\n\n <ModalFooter>\n <Button\n label=\"Close\"\n onClick={onClickClose}\n variant=\"tertiary\"\n size=\"small\"\n />\n </ModalFooter>\n </Modal>\n);\n\nexport default TallyModal;\n\nconst ModalHeader = styled.div`\n margin-bottom: ${Spacing.px12};\n padding: ${Spacing.px12} ${Spacing.px20};\n\n border-bottom: 1px solid ${Color.neutral.grey3};\n\n ${applyTypography(Typography.subheading2Medium)}\n`;\n\nconst ModalBody = styled.div`\n display: flex;\n flex-direction: column;\n\n height: 100%;\n overflow-y: auto;\n`;\n\nconst ModalIframe = styled.iframe`\n width: 100%;\n height: 100%;\n min-height: ${Spacing.px100};\n\n padding: ${Spacing.px4} ${Spacing.px20};\n border: none;\n`;\n\nconst ModalFooter = styled.div`\n display: flex;\n justify-content: space-between;\n gap: ${Spacing.px12};\n\n padding: ${Spacing.px16} ${Spacing.px20};\n`;\n\nconst constructIframeSrc = (\n tallyId: string,\n prefilledFieldsQueryParams?: string,\n) => {\n const queryParams = prefilledFieldsQueryParams\n ? `&${prefilledFieldsQueryParams}`\n : \"\";\n\n return `https://tally.so/embed/${tallyId}?${tallyQueryParams}${queryParams}`;\n};\n\nconst tallyQueryParams =\n \"alignLeft=1&hideTitle=1&transparentBackground=1&dynamicHeight=0\";\n"]}
|
package/core/atoms/Color.d.ts
CHANGED
|
@@ -36,49 +36,15 @@ export declare const accent: {
|
|
|
36
36
|
readonly blue3: "#ECF5FF";
|
|
37
37
|
readonly blue4: "#F5F9FF";
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
readonly black: "#232022";
|
|
46
|
-
readonly grey1: "#999999";
|
|
47
|
-
readonly grey2: "#CCCCCC";
|
|
48
|
-
readonly grey3: "#EEEEEE";
|
|
49
|
-
readonly grey4: "#FAFAFA";
|
|
50
|
-
readonly white: "#FFFFFF";
|
|
51
|
-
};
|
|
52
|
-
readonly typography: {
|
|
53
|
-
readonly blackHigh: "#1A1A1A";
|
|
54
|
-
readonly blackMedium: "#666666";
|
|
55
|
-
readonly blackLow: "#B2B2B2";
|
|
56
|
-
readonly whiteHigh: "#FFFFFF";
|
|
57
|
-
readonly whiteMedium: "#F5F5F5";
|
|
58
|
-
readonly whiteLow: "#E5E5E5";
|
|
59
|
-
};
|
|
60
|
-
readonly accent: {
|
|
61
|
-
readonly red1: "#C02318";
|
|
62
|
-
readonly red2: "#F88E86";
|
|
63
|
-
readonly red3: "#FFE9E7";
|
|
64
|
-
readonly red4: "#FFF1F0";
|
|
65
|
-
readonly yellow1: "#EDAB03";
|
|
66
|
-
readonly yellow2: "#F4CC68";
|
|
67
|
-
readonly yellow3: "#FFF9E8";
|
|
68
|
-
readonly yellow4: "#FFFCF5";
|
|
69
|
-
readonly green1: "#08A45E";
|
|
70
|
-
readonly green2: "#6BC89E";
|
|
71
|
-
readonly green3: "#EBFFF6";
|
|
72
|
-
readonly green4: "#F5FFFA";
|
|
73
|
-
readonly blue1: "#1878E4";
|
|
74
|
-
readonly blue2: "#74AEEF";
|
|
75
|
-
readonly blue3: "#ECF5FF";
|
|
76
|
-
readonly blue4: "#F5F9FF";
|
|
77
|
-
};
|
|
39
|
+
type ValueOf<ObjectType> = ObjectType[keyof ObjectType];
|
|
40
|
+
type ColorGroups = {
|
|
41
|
+
brand: typeof brand;
|
|
42
|
+
neutral: typeof neutral;
|
|
43
|
+
typography: typeof typography;
|
|
44
|
+
accent: typeof accent;
|
|
78
45
|
};
|
|
79
|
-
type ValueOf<T> = T[keyof T];
|
|
80
46
|
type TokenColor = ValueOf<{
|
|
81
|
-
[
|
|
47
|
+
[GroupName in keyof ColorGroups]: ValueOf<ColorGroups[GroupName]>;
|
|
82
48
|
}>;
|
|
83
49
|
export type DesignColor = TokenColor | "transparent";
|
|
84
50
|
export {};
|
package/core/atoms/Color.js
CHANGED
package/core/atoms/Color.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Color.js","sourceRoot":"","sources":["../../../core/atoms/Color.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,cAAc,EAAE,SAAS;IACzB,YAAY,EAAE,SAAS;CACf,CAAC;AAEX,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;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SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,SAAS;CACX,CAAC;AAEX,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,4DAA4D;IAC5D,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,8CAA8C;IAC9C,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,kDAAkD;IAClD,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,qCAAqC;IACrC,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;CACR,CAAC","sourcesContent":["export const brand = {\n grantbiiYellow: \"#EBA338\",\n grantbiiBlue: \"#16538A\",\n} as const;\n\nexport const neutral = {\n black: \"#232022\",\n grey1: \"#999999\",\n grey2: \"#CCCCCC\",\n grey3: \"#EEEEEE\",\n grey4: \"#FAFAFA\",\n white: \"#FFFFFF\",\n} as const;\n\nexport const typography = {\n blackHigh: \"#1A1A1A\",\n blackMedium: \"#666666\",\n blackLow: \"#B2B2B2\",\n whiteHigh: \"#FFFFFF\",\n whiteMedium: \"#F5F5F5\",\n whiteLow: \"#E5E5E5\",\n} as const;\n\nexport const accent = {\n // usually includes dangerous, wrong or rejected information\n red1: \"#C02318\",\n red2: \"#F88E86\",\n red3: \"#FFE9E7\",\n red4: \"#FFF1F0\",\n // usually indicates warning, progressing, etc\n yellow1: \"#EDAB03\",\n yellow2: \"#F4CC68\",\n yellow3: \"#FFF9E8\",\n yellow4: \"#FFFCF5\",\n // usually indicates success, correct, passed, etc\n green1: \"#08A45E\",\n green2: \"#6BC89E\",\n green3: \"#EBFFF6\",\n green4: \"#F5FFFA\",\n // usually indicates info, no emotion\n blue1: \"#1878E4\",\n blue2: \"#74AEEF\",\n blue3: \"#ECF5FF\",\n blue4: \"#F5F9FF\",\n} as const;\n\ntype ValueOf<ObjectType> = ObjectType[keyof ObjectType];\n\ntype ColorGroups = {\n brand: typeof brand;\n neutral: typeof neutral;\n typography: typeof typography;\n accent: typeof accent;\n};\n\ntype TokenColor = ValueOf<{\n [GroupName in keyof ColorGroups]: ValueOf<ColorGroups[GroupName]>;\n}>;\n\nexport type DesignColor = TokenColor | \"transparent\";\n"]}
|
package/core/atoms/Typography.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typography.js","sourceRoot":"","sources":["../../../core/atoms/Typography.ts"],"names":[],"mappings":"AAMA,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAE,QAAgB,EAAmB,EAAE,CAC5E,CAAC;IACC,KAAK,EAAE,GAAG,QAAQ,IAAI;IACtB,KAAK,EAAE,GAAG,SAAS,IAAI;CACxB,CAAU,CAAC;AAEd,MAAM,
|
|
1
|
+
{"version":3,"file":"Typography.js","sourceRoot":"","sources":["../../../core/atoms/Typography.ts"],"names":[],"mappings":"AAMA,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAE,QAAgB,EAAmB,EAAE,CAC5E,CAAC;IACC,KAAK,EAAE,GAAG,QAAQ,IAAI;IACtB,KAAK,EAAE,GAAG,SAAS,IAAI;CACxB,CAAU,CAAC;AAEd,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAA+C;IAChE,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,GAAG;CACV,CAAC;AAQF,MAAM,SAAS,GAAG,CAChB,UAAsB,EACtB,eAAuB,EACvB,iBAAyB,eAAe,GAAG,CAAC,EACjC,EAAE,CAAC,CAAC;IACf,UAAU,EAAE,MAAM,CAAC,OAAO;IAC1B,UAAU;IACV,QAAQ,E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C,IAAI,EAAE,EAAE,CAAC,CAAC;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9D,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import type { ScreenSize } from \"../types\";\n\ntype FontWeightLabel = \"regular\" | \"medium\" | \"bold\";\ntype FontWeight = 400 | 500 | 700;\ntype ResponsiveValue = Record<ScreenSize, string>;\n\nconst responsivePx = (desktopPx: number, mobilePx: number): ResponsiveValue =>\n ({\n small: `${mobilePx}px`,\n large: `${desktopPx}px`,\n }) as const;\n\nexport const family = {\n satoshi: \"Satoshi\",\n};\n\nexport const weight: { [label in FontWeightLabel]: FontWeight } = {\n regular: 400,\n medium: 500,\n bold: 700,\n};\n\nexport type TextStyle = {\n fontFamily: string;\n fontWeight: FontWeight;\n fontSize: ResponsiveValue;\n};\n\nconst textStyle = (\n fontWeight: FontWeight,\n desktopFontSize: number,\n mobileFontSize: number = desktopFontSize - 2,\n): TextStyle => ({\n fontFamily: family.satoshi,\n fontWeight,\n fontSize: responsivePx(desktopFontSize, mobileFontSize),\n});\n\nexport const heading1 = textStyle(weight.bold, 32);\nexport const heading2 = textStyle(weight.bold, 28);\nexport const heading3 = textStyle(weight.bold, 24);\n\nexport const subheading1Bold = textStyle(weight.bold, 20);\nexport const subheading1Medium = textStyle(weight.medium, 20);\nexport const subheading1Regular = textStyle(weight.regular, 20);\n\nexport const subheading2Bold = textStyle(weight.bold, 18);\nexport const subheading2Medium = textStyle(weight.medium, 18);\nexport const subheading2Regular = textStyle(weight.regular, 18);\n\nexport const bodyPrimaryBold = textStyle(weight.bold, 16);\nexport const bodyPrimaryMedium = textStyle(weight.medium, 16);\nexport const bodyPrimaryRegular = textStyle(weight.regular, 16);\n\nexport const bodySecondaryBold = textStyle(weight.bold, 14);\nexport const bodySecondaryMedium = textStyle(weight.medium, 14);\nexport const bodySecondaryRegular = textStyle(weight.regular, 14);\n\nexport const captionBold = textStyle(weight.bold, 12, 12);\nexport const captionMedium = textStyle(weight.medium, 12, 12);\nexport const captionRegular = textStyle(weight.regular, 12, 12);\n"]}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
2
|
type ModalProps = {
|
|
3
|
-
header?: ReactNode;
|
|
4
|
-
content: JSX.Element;
|
|
5
|
-
footer?: ReactNode;
|
|
6
3
|
width?: string;
|
|
7
4
|
height?: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
declare const Modal: ({ header, content, footer, width, height, onClickClose, closeText, }: ModalProps) => import("react").ReactPortal;
|
|
5
|
+
} & PropsWithChildren;
|
|
6
|
+
declare const Modal: ({ width, height, children }: ModalProps) => import("react").ReactPortal;
|
|
12
7
|
export default Modal;
|
|
13
8
|
export declare const useModal: () => {
|
|
14
|
-
showModal: boolean;
|
|
15
9
|
openModal: () => void;
|
|
16
10
|
closeModal: () => void;
|
|
11
|
+
isModalOpen: boolean;
|
|
17
12
|
};
|
package/core/organisms/Modal.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import { useCallback, useState
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import styled from "styled-components";
|
|
5
|
-
import { Color, Responsive } from "../atoms";
|
|
6
|
-
import {
|
|
7
|
-
const Modal = ({
|
|
5
|
+
import { Color, Responsive, Spacing } from "../atoms";
|
|
6
|
+
import { Overlay } from "../molecules";
|
|
7
|
+
const Modal = ({ width, height, children }) => createPortal(_jsx(Overlay, { "$centerContent": true, children: _jsx(ModalWindow, { "$width": width, "$height": height, children: children }) }), document.body);
|
|
8
8
|
export default Modal;
|
|
9
9
|
export const useModal = () => {
|
|
10
|
-
const [
|
|
10
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
11
11
|
const lockScroll = useCallback(() => {
|
|
12
12
|
document.body.style.overflow = "hidden";
|
|
13
13
|
}, []);
|
|
@@ -15,17 +15,17 @@ export const useModal = () => {
|
|
|
15
15
|
document.body.style.overflow = "initial";
|
|
16
16
|
}, []);
|
|
17
17
|
const openModal = () => {
|
|
18
|
-
|
|
18
|
+
setIsModalOpen(true);
|
|
19
19
|
lockScroll();
|
|
20
20
|
};
|
|
21
21
|
const closeModal = () => {
|
|
22
|
-
|
|
22
|
+
setIsModalOpen(false);
|
|
23
23
|
unlockScroll();
|
|
24
24
|
};
|
|
25
25
|
return {
|
|
26
|
-
showModal,
|
|
27
26
|
openModal,
|
|
28
27
|
closeModal,
|
|
28
|
+
isModalOpen,
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
const ModalWindow = styled.div `
|
|
@@ -34,7 +34,7 @@ const ModalWindow = styled.div `
|
|
|
34
34
|
|
|
35
35
|
background-color: ${Color.neutral.white};
|
|
36
36
|
|
|
37
|
-
min-height:
|
|
37
|
+
min-height: ${Spacing.px100};
|
|
38
38
|
max-height: 100vh;
|
|
39
39
|
|
|
40
40
|
@media (width < ${Responsive.widthBreakpoint.laptop}) {
|
|
@@ -56,40 +56,7 @@ const ModalWindow = styled.div `
|
|
|
56
56
|
width: ${({ $width }) => $width};
|
|
57
57
|
height: ${({ $height }) => $height};
|
|
58
58
|
|
|
59
|
-
border-radius:
|
|
59
|
+
border-radius: ${Spacing.px8};
|
|
60
60
|
}
|
|
61
61
|
`;
|
|
62
|
-
const ModalHeader = styled.div `
|
|
63
|
-
font-weight: 500;
|
|
64
|
-
font-size: 18px;
|
|
65
|
-
|
|
66
|
-
padding: 12px 20px;
|
|
67
|
-
margin-bottom: 12px;
|
|
68
|
-
|
|
69
|
-
border-bottom: 1px solid ${Color.neutral.grey3};
|
|
70
|
-
`;
|
|
71
|
-
const ModalBody = styled.div `
|
|
72
|
-
display: flex;
|
|
73
|
-
flex-direction: column;
|
|
74
|
-
|
|
75
|
-
height: 100%;
|
|
76
|
-
overflow-y: auto;
|
|
77
|
-
|
|
78
|
-
> * {
|
|
79
|
-
width: 100%;
|
|
80
|
-
height: 100%;
|
|
81
|
-
min-height: 100px;
|
|
82
|
-
|
|
83
|
-
padding: 2px 20px;
|
|
84
|
-
border: none;
|
|
85
|
-
}
|
|
86
|
-
`;
|
|
87
|
-
const ModalFooter = styled.div `
|
|
88
|
-
display: flex;
|
|
89
|
-
justify-content: space-between;
|
|
90
|
-
gap: 12px;
|
|
91
|
-
|
|
92
|
-
padding: 16px 20px;
|
|
93
|
-
`;
|
|
94
|
-
const CloseButton = ({ onClick, closeText = "Close" }) => (_jsx(Button, { label: closeText, onClick: onClick, variant: "tertiary", size: "small" }));
|
|
95
62
|
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../core/organisms/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../core/organisms/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAA0B,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAA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e,CAAC,MAAM;;;;;;;;;;;qBAWhC,UAAU,CAAC,eAAe,CAAC,MAAM;;;;;aAKzC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM;cACrB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO;;qBAEjB,OAAO,CAAC,GAAG;;CAE/B,CAAC","sourcesContent":["import { type PropsWithChildren, useCallback, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport styled from \"styled-components\";\nimport { Color, Responsive, Spacing } from \"../atoms\";\nimport { Overlay } from \"../molecules\";\n\ntype ModalProps = {\n width?: string;\n height?: string;\n} & PropsWithChildren;\n\nconst Modal = ({ width, height, children }: ModalProps) =>\n createPortal(\n <Overlay $centerContent>\n <ModalWindow $width={width} $height={height}>\n {children}\n </ModalWindow>\n </Overlay>,\n document.body,\n );\n\nexport default Modal;\n\nexport const useModal = () => {\n const [isModalOpen, setIsModalOpen] = 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 setIsModalOpen(true);\n lockScroll();\n };\n\n const closeModal = () => {\n setIsModalOpen(false);\n unlockScroll();\n };\n\n return {\n openModal,\n closeModal,\n isModalOpen,\n };\n};\n\nconst ModalWindow = styled.div<{ $width?: string; $height?: string }>`\n display: flex;\n flex-direction: column;\n\n background-color: ${Color.neutral.white};\n\n min-height: ${Spacing.px100};\n max-height: 100vh;\n\n @media (width < ${Responsive.widthBreakpoint.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.widthBreakpoint.laptop}) {\n position: static;\n bottom: auto;\n left: auto;\n\n width: ${({ $width }) => $width};\n height: ${({ $height }) => $height};\n\n border-radius: ${Spacing.px8};\n }\n`;\n"]}
|
|
@@ -2,44 +2,71 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import Image from "next/image";
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
import grantMatchLogo from "../../assets/logos/grant_match_logo.webp";
|
|
5
|
+
import { Color, Spacing, Typography } from "../../atoms";
|
|
6
|
+
import { applyTypography } from "../../integrations";
|
|
5
7
|
import { Button, Textarea } from "../../molecules";
|
|
8
|
+
import { Modal } from "../../organisms";
|
|
6
9
|
import FileDrop, { useFileDrop } from "../../organisms/FileDrop";
|
|
7
|
-
import Modal from "../../organisms/Modal";
|
|
8
10
|
import { useGrantMatchContext } from "./context";
|
|
9
11
|
const GrantMatchModal = ({ findGrantsCallback, closeModalCallback, }) => {
|
|
10
|
-
const {
|
|
12
|
+
const { closeModal, updateActiveQuery, queryText, activeQuery } = useGrantMatchContext();
|
|
11
13
|
const { files, uploadFiles, removeFile, errorMessage } = useFileDrop(activeQuery.files);
|
|
14
|
+
const onClickFind = () => {
|
|
15
|
+
findGrantsCallback?.();
|
|
16
|
+
updateActiveQuery({ files, text: queryText });
|
|
17
|
+
closeModal();
|
|
18
|
+
};
|
|
12
19
|
const onClickClose = () => {
|
|
13
|
-
|
|
14
|
-
closeModalCallback();
|
|
15
|
-
}
|
|
20
|
+
closeModalCallback?.();
|
|
16
21
|
closeModal();
|
|
17
22
|
};
|
|
18
|
-
return (
|
|
23
|
+
return (_jsxs(Modal, { width: "600px", height: "560px", children: [_jsx(ModalHeader, {}), _jsx(ModalBody, { children: _jsx(ModalContent, { files: files, uploadFiles: uploadFiles, removeFile: removeFile, errorMessage: errorMessage }) }), _jsx(ModalFooter, { files: files, onClickFind: onClickFind, onClickClose: onClickClose })] }));
|
|
19
24
|
};
|
|
20
25
|
export default GrantMatchModal;
|
|
21
26
|
const ModalHeader = () => (_jsxs(BaseModalHeader, { children: [_jsx(GrantMatchLogo, { src: grantMatchLogo, alt: "Grant Match", width: 64, height: 64 }), _jsx("p", { children: "Let us get you matched to the most suitable grant" })] }));
|
|
22
27
|
const BaseModalHeader = styled.div `
|
|
23
28
|
display: flex;
|
|
24
29
|
align-items: center;
|
|
25
|
-
gap:
|
|
30
|
+
gap: ${Spacing.px16};
|
|
31
|
+
|
|
32
|
+
margin-bottom: ${Spacing.px12};
|
|
33
|
+
padding: ${Spacing.px12} ${Spacing.px20};
|
|
34
|
+
|
|
35
|
+
border-bottom: 1px solid ${Color.neutral.grey3};
|
|
36
|
+
|
|
37
|
+
${applyTypography(Typography.subheading2Medium)}
|
|
26
38
|
`;
|
|
27
39
|
const GrantMatchLogo = styled(Image) `
|
|
28
|
-
width:
|
|
29
|
-
height:
|
|
40
|
+
width: ${Spacing.px24};
|
|
41
|
+
height: ${Spacing.px24};
|
|
30
42
|
|
|
31
43
|
box-shadow: 0px 0px 5px 5px #ffe2b680;
|
|
32
44
|
border-radius: 120px;
|
|
33
45
|
`;
|
|
46
|
+
const ModalBody = styled.div `
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
|
|
50
|
+
height: 100%;
|
|
51
|
+
overflow-y: auto;
|
|
52
|
+
`;
|
|
34
53
|
const ModalContent = ({ files, uploadFiles, removeFile, errorMessage, }) => {
|
|
35
54
|
const { queryText, updateQueryText } = useGrantMatchContext();
|
|
36
|
-
return (_jsxs(BaseContent, { children: [_jsxs(ModalFileDrop, { children: [_jsx("p", { children: "Upload Files (e.g. Project Plan, Proposal, Company Docs)" }), _jsx(FileDrop, { uploadedFiles: files, uploadFiles: uploadFiles, removeFile: removeFile, errorMessage: errorMessage })] }), _jsxs(ModalQueryText, { children: [_jsx("label", { htmlFor:
|
|
55
|
+
return (_jsxs(BaseContent, { children: [_jsxs(ModalFileDrop, { children: [_jsx("p", { children: "Upload Files (e.g. Project Plan, Proposal, Company Docs)" }), _jsx(FileDrop, { uploadedFiles: files, uploadFiles: uploadFiles, removeFile: removeFile, errorMessage: errorMessage })] }), _jsxs(ModalQueryText, { children: [_jsx("label", { htmlFor: textareaId, children: "Tell us what you intend to do" }), _jsx(Textarea, { id: textareaId, value: queryText, onChange: (event) => updateQueryText(event.target.value), placeholder: textareaPlaceholder })] })] }));
|
|
37
56
|
};
|
|
38
|
-
const
|
|
57
|
+
const textareaId = "query-textarea";
|
|
58
|
+
const textareaPlaceholder = "Give a summary of your project, specifying the key activities you will do & what you intend to achieve";
|
|
39
59
|
const BaseContent = styled.div `
|
|
40
60
|
display: flex;
|
|
41
61
|
flex-direction: column;
|
|
42
|
-
gap:
|
|
62
|
+
gap: ${Spacing.px12};
|
|
63
|
+
|
|
64
|
+
width: 100%;
|
|
65
|
+
height: 100%;
|
|
66
|
+
min-height: ${Spacing.px100};
|
|
67
|
+
|
|
68
|
+
padding: ${Spacing.px4} ${Spacing.px20};
|
|
69
|
+
border: none;
|
|
43
70
|
`;
|
|
44
71
|
const ModalFileDrop = styled.div `
|
|
45
72
|
display: flex;
|
|
@@ -49,16 +76,16 @@ const ModalQueryText = styled.div `
|
|
|
49
76
|
display: flex;
|
|
50
77
|
flex-direction: column;
|
|
51
78
|
`;
|
|
52
|
-
const
|
|
53
|
-
const {
|
|
79
|
+
const ModalFooter = ({ files, onClickFind, onClickClose, }) => {
|
|
80
|
+
const { queryText } = useGrantMatchContext();
|
|
54
81
|
const hasQuery = queryText.trim() !== "" || files.length > 0;
|
|
55
|
-
|
|
56
|
-
if (findGrantsCallback) {
|
|
57
|
-
findGrantsCallback();
|
|
58
|
-
}
|
|
59
|
-
updateActiveQuery({ files, text: queryText });
|
|
60
|
-
closeModal();
|
|
61
|
-
};
|
|
62
|
-
return (_jsx(Button, { label: "Find My Grants", disabled: !hasQuery, onClick: onClick, variant: "secondary", size: "small" }));
|
|
82
|
+
return (_jsxs(BaseModalFooter, { children: [_jsx(Button, { label: "Close", onClick: onClickClose, variant: "tertiary", size: "small" }), _jsx(Button, { label: "Find My Grants", disabled: !hasQuery, onClick: onClickFind, variant: "secondary", size: "small" })] }));
|
|
63
83
|
};
|
|
84
|
+
const BaseModalFooter = styled.div `
|
|
85
|
+
display: flex;
|
|
86
|
+
justify-content: space-between;
|
|
87
|
+
gap: ${Spacing.px12};
|
|
88
|
+
|
|
89
|
+
padding: ${Spacing.px16} ${Spacing.px20};
|
|
90
|
+
`;
|
|
64
91
|
//# sourceMappingURL=GrantMatchModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrantMatchModal.js","sourceRoot":"","sources":["../../../../core/templates/GrantMatch/GrantMatchModal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"GrantMatchModal.js","sourceRoot":"","sources":["../../../../core/templates/GrantMatch/GrantMatchModal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,cAAc,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,QAAQ,EAAE,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAOjD,MAAM,eAAe,GAAG,CAAC,EACvB,kBAAkB,EAClB,kBAAkB,GACG,EAAE,EAAE;IACzB,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,GAC7D,oBAAoB,EAAE,CAAC;IACzB,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,WAAW,CAClE,WAAW,CAAC,KAAK,CAClB,CAAC;IAEF,MAAM,WAAW,GAAG,GAAG,EAAE;QAC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,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAE7D,OAAO,CACL,MAAC,eAAe,eACd,KAAC,MAAM,IACL,KAAK,EAAC,OAAO,EACb,OAAO,EAAE,YAAY,EACrB,OAAO,EAAC,UAAU,EAClB,IAAI,EAAC,OAAO,GACZ,EAEF,KAAC,MAAM,IACL,KAAK,EAAC,gBAAgB,EACtB,QAAQ,EAAE,CAAC,QAAQ,EACnB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,OAAO,GACZ,IACc,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;SAGzB,OAAO,CAAC,IAAI;;aAER,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI;CACxC,CAAC","sourcesContent":["import Image from \"next/image\";\nimport type { MouseEventHandler } from \"react\";\nimport styled from \"styled-components\";\nimport grantMatchLogo from \"../../assets/logos/grant_match_logo.webp\";\nimport { Color, Spacing, Typography } from \"../../atoms\";\nimport { applyTypography } from \"../../integrations\";\nimport { Button, Textarea } from \"../../molecules\";\nimport { Modal } from \"../../organisms\";\nimport FileDrop, { useFileDrop } from \"../../organisms/FileDrop\";\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 { closeModal, updateActiveQuery, queryText, activeQuery } =\n useGrantMatchContext();\n const { files, uploadFiles, removeFile, errorMessage } = useFileDrop(\n activeQuery.files,\n );\n\n const onClickFind = () => {\n findGrantsCallback?.();\n updateActiveQuery({ files, text: queryText });\n closeModal();\n };\n\n const onClickClose = () => {\n closeModalCallback?.();\n closeModal();\n };\n\n return (\n <Modal width=\"600px\" height=\"560px\">\n <ModalHeader />\n\n <ModalBody>\n <ModalContent\n files={files}\n uploadFiles={uploadFiles}\n removeFile={removeFile}\n errorMessage={errorMessage}\n />\n </ModalBody>\n\n <ModalFooter\n files={files}\n onClickFind={onClickFind}\n onClickClose={onClickClose}\n />\n </Modal>\n );\n};\n\nexport default GrantMatchModal;\n\nconst ModalHeader = () => (\n <BaseModalHeader>\n <GrantMatchLogo\n src={grantMatchLogo}\n alt=\"Grant Match\"\n width={64}\n height={64}\n />\n <p>Let us get you matched to the most suitable grant</p>\n </BaseModalHeader>\n);\n\nconst BaseModalHeader = styled.div`\n display: flex;\n align-items: center;\n gap: ${Spacing.px16};\n\n margin-bottom: ${Spacing.px12};\n padding: ${Spacing.px12} ${Spacing.px20};\n\n border-bottom: 1px solid ${Color.neutral.grey3};\n\n ${applyTypography(Typography.subheading2Medium)}\n`;\n\nconst GrantMatchLogo = styled(Image)`\n width: ${Spacing.px24};\n height: ${Spacing.px24};\n\n box-shadow: 0px 0px 5px 5px #ffe2b680;\n border-radius: 120px;\n`;\n\nconst ModalBody = styled.div`\n display: flex;\n flex-direction: column;\n\n height: 100%;\n overflow-y: auto;\n`;\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 <ModalFileDrop>\n <p>Upload Files (e.g. Project Plan, Proposal, Company Docs)</p>\n <FileDrop\n uploadedFiles={files}\n uploadFiles={uploadFiles}\n removeFile={removeFile}\n errorMessage={errorMessage}\n />\n </ModalFileDrop>\n\n <ModalQueryText>\n <label htmlFor={textareaId}>Tell us what you intend to do</label>\n <Textarea\n id={textareaId}\n value={queryText}\n onChange={(event) => updateQueryText(event.target.value)}\n placeholder={textareaPlaceholder}\n />\n </ModalQueryText>\n </BaseContent>\n );\n};\n\nconst textareaId = \"query-textarea\";\nconst textareaPlaceholder =\n \"Give a summary of your project, specifying the key activities you will do & what you intend to achieve\";\n\nconst BaseContent = styled.div`\n display: flex;\n flex-direction: column;\n gap: ${Spacing.px12};\n\n width: 100%;\n height: 100%;\n min-height: ${Spacing.px100};\n\n padding: ${Spacing.px4} ${Spacing.px20};\n border: none;\n`;\n\nconst ModalFileDrop = styled.div`\n display: flex;\n flex-direction: column;\n`;\n\nconst ModalQueryText = styled.div`\n display: flex;\n flex-direction: column;\n`;\n\ntype ModalFooterProps = {\n files: File[];\n onClickFind: MouseEventHandler<HTMLElement>;\n onClickClose: MouseEventHandler<HTMLElement>;\n};\n\nconst ModalFooter = ({\n files,\n onClickFind,\n onClickClose,\n}: ModalFooterProps) => {\n const { queryText } = useGrantMatchContext();\n const hasQuery = queryText.trim() !== \"\" || files.length > 0;\n\n return (\n <BaseModalFooter>\n <Button\n label=\"Close\"\n onClick={onClickClose}\n variant=\"tertiary\"\n size=\"small\"\n />\n\n <Button\n label=\"Find My Grants\"\n disabled={!hasQuery}\n onClick={onClickFind}\n variant=\"secondary\"\n size=\"small\"\n />\n </BaseModalFooter>\n );\n};\n\nconst BaseModalFooter = styled.div`\n display: flex;\n justify-content: space-between;\n gap: ${Spacing.px12};\n\n padding: ${Spacing.px16} ${Spacing.px20};\n`;\n"]}
|
|
@@ -9,33 +9,25 @@ import GrantMatchModal from "./GrantMatchModal";
|
|
|
9
9
|
import OpenModalButton from "./OpenModalButton";
|
|
10
10
|
import { GrantMatchContext } from "./context";
|
|
11
11
|
const GrantMatch = ({ activeQuery, updateActiveQuery, textSearchCallback, findGrantsCallback, closeModalCallback, openModalCallback, }) => {
|
|
12
|
-
const {
|
|
12
|
+
const { isModalOpen, openModal, closeModal } = useModal();
|
|
13
13
|
const [queryText, setQueryText] = useState(activeQuery.text);
|
|
14
|
-
const updateQueryText = (newText) => setQueryText(newText);
|
|
15
14
|
const commonProps = useMemo(() => ({
|
|
16
15
|
activeQuery,
|
|
17
16
|
updateActiveQuery,
|
|
18
17
|
queryText,
|
|
19
|
-
updateQueryText,
|
|
18
|
+
updateQueryText: setQueryText,
|
|
20
19
|
openModal,
|
|
21
20
|
closeModal,
|
|
22
|
-
}), [
|
|
23
|
-
activeQuery,
|
|
24
|
-
updateActiveQuery,
|
|
25
|
-
queryText,
|
|
26
|
-
updateQueryText,
|
|
27
|
-
openModal,
|
|
28
|
-
closeModal,
|
|
29
|
-
]);
|
|
21
|
+
}), [activeQuery, updateActiveQuery, queryText, openModal, closeModal]);
|
|
30
22
|
const handleSearch = () => {
|
|
31
23
|
updateActiveQuery({ files: activeQuery.files, text: queryText });
|
|
32
24
|
textSearchCallback?.();
|
|
33
25
|
};
|
|
34
26
|
const handleReset = () => {
|
|
35
|
-
|
|
27
|
+
setQueryText("");
|
|
36
28
|
updateActiveQuery({ files: activeQuery.files, text: "" });
|
|
37
29
|
};
|
|
38
|
-
return (_jsx(GrantMatchContext.Provider, { value: commonProps, children: _jsxs(BaseGrantMatch, { children: [_jsxs(SearchBarContainer, { children: [_jsx(SearchBar, { queryText: queryText, onChangeQueryText: (event) => setQueryText(event.target.value), handlePressEnter: () => handleSearch(), onClickSearch: () => handleSearch(), onClickReset: () => handleReset(), size: "small" }), _jsx(OpenModalButton, { openModalCallback: openModalCallback })] }), activeQuery.files.length > 0 ? _jsx(ActiveQueryFiles, {}) : _jsx(_Fragment, {}),
|
|
30
|
+
return (_jsx(GrantMatchContext.Provider, { value: commonProps, children: _jsxs(BaseGrantMatch, { children: [_jsxs(SearchBarContainer, { children: [_jsx(SearchBar, { queryText: queryText, onChangeQueryText: (event) => setQueryText(event.target.value), handlePressEnter: () => handleSearch(), onClickSearch: () => handleSearch(), onClickReset: () => handleReset(), size: "small" }), _jsx(OpenModalButton, { openModalCallback: openModalCallback })] }), activeQuery.files.length > 0 ? _jsx(ActiveQueryFiles, {}) : _jsx(_Fragment, {}), isModalOpen ? (_jsx(GrantMatchModal, { findGrantsCallback: findGrantsCallback, closeModalCallback: closeModalCallback })) : (_jsx(_Fragment, {}))] }) }));
|
|
39
31
|
};
|
|
40
32
|
export default GrantMatch;
|
|
41
33
|
const BaseGrantMatch = styled.div `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../core/templates/GrantMatch/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAW9C,MAAM,UAAU,GAAG,CAAC,EAClB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GACD,EAAE,EAAE;IACpB,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../core/templates/GrantMatch/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,gBAAgB,M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AC,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/entities\";\nimport { checkGrantMatchActive } from \"@grantbii/ui-core/match/validations\";\nimport { useMemo, useState } from \"react\";\nimport styled from \"styled-components\";\nimport { Color, Responsive, Spacing } from \"../../atoms\";\nimport { SearchBar, useModal } from \"../../organisms\";\nimport ActiveQueryFiles from \"./ActiveQueryFiles\";\nimport GrantMatchModal from \"./GrantMatchModal\";\nimport OpenModalButton from \"./OpenModalButton\";\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 { isModalOpen, openModal, closeModal } = useModal();\n const [queryText, setQueryText] = useState(activeQuery.text);\n\n const commonProps = useMemo(\n () => ({\n activeQuery,\n updateActiveQuery,\n queryText,\n updateQueryText: setQueryText,\n openModal,\n closeModal,\n }),\n [activeQuery, updateActiveQuery, queryText, openModal, closeModal],\n );\n\n const handleSearch = () => {\n updateActiveQuery({ files: activeQuery.files, text: queryText });\n textSearchCallback?.();\n };\n\n const handleReset = () => {\n setQueryText(\"\");\n updateActiveQuery({ files: activeQuery.files, text: \"\" });\n };\n\n return (\n <GrantMatchContext.Provider value={commonProps}>\n <BaseGrantMatch>\n <SearchBarContainer>\n <SearchBar\n queryText={queryText}\n onChangeQueryText={(event) => setQueryText(event.target.value)}\n handlePressEnter={() => handleSearch()}\n onClickSearch={() => handleSearch()}\n onClickReset={() => handleReset()}\n size=\"small\"\n />\n <OpenModalButton openModalCallback={openModalCallback} />\n </SearchBarContainer>\n\n {activeQuery.files.length > 0 ? <ActiveQueryFiles /> : <></>}\n\n {isModalOpen ? (\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: ${Spacing.px8};\n\n width: 100%;\n max-width: 100vw;\n`;\n\nconst SearchBarContainer = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n width: 100%;\n\n color: ${Color.typography.blackHigh};\n background-color: ${Color.neutral.white};\n\n @media (width < ${Responsive.widthBreakpoint.laptop}) {\n gap: ${Spacing.px8};\n padding: 0px;\n\n box-shadow: none;\n border-radius: 0px;\n }\n\n @media (width >= ${Responsive.widthBreakpoint.laptop}) {\n gap: ${Spacing.px16};\n padding: ${Spacing.px12} ${Spacing.px16};\n\n box-shadow: 0px 0px ${Spacing.px40} 0px #00000008;\n border-radius: ${Spacing.px12};\n }\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"]}
|