@grantbii/design-system 1.26.0 → 1.28.0
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/README.md +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/molecules/Button.d.ts +2 -2
- package/core/molecules/Button.js.map +1 -1
- package/core/molecules/index.d.ts +1 -1
- package/core/molecules/index.js +1 -1
- package/core/molecules/index.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/organisms/SearchBar.d.ts +4 -2
- package/core/organisms/SearchBar.js +2 -2
- package/core/organisms/SearchBar.js.map +1 -1
- package/core/organisms/index.d.ts +1 -1
- package/core/organisms/index.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 +10 -10
- 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/organisms/SearchBar.stories.d.ts +1 -0
- package/stories/organisms/SearchBar.stories.js +5 -2
- package/stories/organisms/SearchBar.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
package/README.md
CHANGED
|
@@ -59,6 +59,6 @@ Check which files would be published with `npm publish --dry-run`
|
|
|
59
59
|
|
|
60
60
|
The package is published to npm automatically with [GitHub Actions](.github/workflows/continuous-delivery.yaml).
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
The corresponding documentation is published to GitHub pages automatically with [GitHub Actions](.github/workflows/continuous-delivery.yaml).
|
|
63
63
|
|
|
64
64
|
Once a commit has been made on the `prod` branch, a build would be triggered.
|
|
@@ -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,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EA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AAO,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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes, HTMLAttributeAnchorTarget, MouseEventHandler, ReactNode } from "react";
|
|
2
2
|
import { Color, SystemIcon } from "../atoms";
|
|
3
|
-
type ButtonVariant = "primary" | "secondary" | "tertiary" | "outline" | "ghost" | "text" | "danger";
|
|
4
|
-
type ButtonSize = "small" | "medium" | "large";
|
|
3
|
+
export type ButtonVariant = "primary" | "secondary" | "tertiary" | "outline" | "ghost" | "text" | "danger";
|
|
4
|
+
export type ButtonSize = "small" | "medium" | "large";
|
|
5
5
|
type CustomButtonProps = {
|
|
6
6
|
label?: ReactNode;
|
|
7
7
|
Icon?: SystemIcon.Icon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../core/molecules/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAO7B,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA6BlE,MAAM,MAAM,GAAG,CAAC,EACd,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,QAAQ,EACf,GAAG,WAAW,EACF,EAAE,EAAE;I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,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,eAAe;;;aAGxC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW;wBACjB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,qBAAqB;;;;aAIjD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc;wBACpB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,wBAAwB;;CAEhE,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAkB;IAC3C,WAAW;CACd,CAAC;AAEF,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAkB;IAC9C,WAAW;CACd,CAAC","sourcesContent":["import Link from \"next/link\";\nimport type {\n ButtonHTMLAttributes,\n HTMLAttributeAnchorTarget,\n MouseEventHandler,\n ReactNode,\n} from \"react\";\nimport styled, { css } from \"styled-components\";\nimport { Color, Spacing, SystemIcon, Typography } from \"../atoms\";\n\ntype ButtonVariant =\n | \"primary\"\n | \"secondary\"\n | \"tertiary\"\n | \"outline\"\n | \"ghost\"\n | \"text\"\n | \"danger\";\n\ntype ButtonSize = \"small\" | \"medium\" | \"large\";\n\ntype CustomButtonProps = {\n label?: ReactNode;\n Icon?: SystemIcon.Icon;\n iconRight?: boolean;\n onClick?: MouseEventHandler<HTMLElement>;\n type?: ButtonHTMLAttributes<HTMLButtonElement>[\"type\"];\n disabled?: boolean;\n target?: HTMLAttributeAnchorTarget;\n href?: string;\n};\n\ntype ButtonProps = {\n variant?: ButtonVariant;\n size?: ButtonSize;\n} & CustomButtonProps;\n\nconst Button = ({\n variant = \"primary\",\n size = \"medium\",\n ...restOfProps\n}: ButtonProps) => {\n const variantProps = VARIANT_PROPS_MAP[variant];\n const sizeProps = SIZE_PROPS_MAP[size];\n\n return <RawButton {...variantProps} {...sizeProps} {...restOfProps} />;\n};\n\nexport default Button;\n\ntype VariantStyleProps = {\n defaultColor: Color.DesignColor;\n hoverColor?: Color.DesignColor;\n disabledColor?: Color.DesignColor;\n defaultBackgroundColor: Color.DesignColor;\n hoverBackgroundColor?: Color.DesignColor;\n disabledBackgroundColor?: Color.DesignColor;\n borderColor?: Color.DesignColor;\n textDecoration?: string;\n};\n\nconst VARIANT_PROPS_MAP: { [variant in ButtonVariant]: VariantStyleProps } = {\n primary: {\n defaultColor: Color.typography.whiteHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: Color.brand.grantbiiBlue,\n hoverBackgroundColor: Color.accent.blue2,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n secondary: {\n defaultColor: Color.typography.blackHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: Color.brand.grantbiiYellow,\n hoverBackgroundColor: Color.accent.yellow2,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n tertiary: {\n defaultColor: Color.typography.blackHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: Color.neutral.grey3,\n hoverBackgroundColor: Color.accent.blue3,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n outline: {\n defaultColor: Color.typography.blackHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: \"transparent\",\n hoverBackgroundColor: Color.accent.blue3,\n borderColor: Color.neutral.grey2,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n ghost: {\n defaultColor: Color.typography.blackHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: \"transparent\",\n hoverBackgroundColor: Color.accent.blue3,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n text: {\n defaultColor: Color.typography.blackHigh,\n hoverColor: Color.typography.blackMedium,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: \"transparent\",\n textDecoration: \"underline\",\n },\n danger: {\n defaultColor: Color.typography.whiteHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: Color.accent.red1,\n hoverBackgroundColor: Color.accent.red2,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n};\n\ntype SizeStyleProps = {\n width?: string;\n height?: string;\n padding?: string;\n fontSize?: string;\n};\n\nconst SIZE_PROPS_MAP: { [size in ButtonSize]: SizeStyleProps } = {\n small: {\n height: \"40px\",\n padding: `10px ${Spacing.px16}`, // not following spacing scale\n fontSize: \"14px\",\n },\n medium: {\n height: \"46px\",\n padding: `12px ${Spacing.px16}`, // not following spacing scale\n fontSize: \"16px\",\n },\n large: {\n height: \"52px\",\n padding: `14px ${Spacing.px16}`, // not following spacing scale\n fontSize: \"18px\",\n },\n};\n\ntype RawButtonProps = CustomButtonProps & VariantStyleProps & SizeStyleProps;\n\nexport const RawButton = ({\n Icon,\n iconRight = false,\n label,\n href,\n target,\n disabled,\n type,\n width = \"auto\",\n height = \"46px\",\n padding = `12px ${Spacing.px16}`,\n fontSize = \"16px\",\n textDecoration = \"none\",\n defaultColor,\n hoverColor = defaultColor,\n disabledColor = defaultColor,\n defaultBackgroundColor,\n hoverBackgroundColor = defaultBackgroundColor,\n disabledBackgroundColor = defaultBackgroundColor,\n borderColor,\n ...restOfProps\n}: RawButtonProps) => {\n const isActionIcon = !!Icon && !label;\n\n const styleProps: ButtonStyleProps = {\n $isActionIcon: isActionIcon,\n $width: width,\n $height: height,\n $padding: padding,\n $fontSize: fontSize,\n $textDecoration: textDecoration,\n $defaultColor: defaultColor,\n $hoverColor: hoverColor,\n $disabledColor: disabledColor,\n $defaultBackgroundColor: defaultBackgroundColor,\n $hoverBackgroundColor: hoverBackgroundColor,\n $disabledBackgroundColor: disabledBackgroundColor,\n $borderColor: borderColor,\n };\n\n const content = (\n <>\n {Icon && !iconRight && <Icon size={20} />}\n {label}\n {Icon && iconRight && <Icon size={20} />}\n </>\n );\n\n const isLink = !!href && !disabled;\n\n return isLink ? (\n <BaseLink {...restOfProps} {...styleProps} href={href} target={target}>\n {content}\n </BaseLink>\n ) : (\n <BaseButton\n {...restOfProps}\n {...styleProps}\n disabled={disabled}\n type={type}\n >\n {content}\n </BaseButton>\n );\n};\n\ntype ButtonStyleProps = {\n $isActionIcon: boolean;\n $width: string;\n $height: string;\n $padding: string;\n $fontSize: string;\n $textDecoration: string;\n $defaultColor: Color.DesignColor;\n $hoverColor: Color.DesignColor;\n $disabledColor: Color.DesignColor;\n $defaultBackgroundColor: Color.DesignColor;\n $hoverBackgroundColor: Color.DesignColor;\n $disabledBackgroundColor: Color.DesignColor;\n $borderColor?: Color.DesignColor;\n};\n\nconst ButtonStyle = css<ButtonStyleProps>`\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n gap: ${Spacing.px8};\n\n box-sizing: border-box;\n width: ${(props) => (props.$isActionIcon ? props.$height : props.$width)};\n min-width: ${(props) => (props.$isActionIcon ? props.$height : \"auto\")};\n height: ${(props) => props.$height};\n padding: ${(props) => (props.$isActionIcon ? \"0px\" : props.$padding)};\n\n font-weight: ${Typography.weight.medium};\n font-size: ${(props) => props.$fontSize};\n white-space: nowrap;\n\n color: ${(props) => props.$defaultColor};\n background-color: ${(props) => props.$defaultBackgroundColor};\n\n border: ${(props) =>\n props.$borderColor ? `1px solid ${props.$borderColor}` : \"none\"};\n border-radius: ${Spacing.px8};\n\n text-decoration: ${(props) => props.$textDecoration};\n\n &:hover {\n color: ${(props) => props.$hoverColor};\n background-color: ${(props) => props.$hoverBackgroundColor};\n }\n\n &:disabled {\n color: ${(props) => props.$disabledColor};\n background-color: ${(props) => props.$disabledBackgroundColor};\n }\n`;\n\nconst BaseLink = styled(Link)<ButtonStyleProps>`\n ${ButtonStyle}\n`;\n\nconst BaseButton = styled.button<ButtonStyleProps>`\n ${ButtonStyle}\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../core/molecules/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAO7B,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE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,EAAE,CAClB,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,MAAM;mBAChD,OAAO,CAAC,GAAG;;qBAET,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,eAAe;;;aAGxC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW;wBACjB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,qBAAqB;;;;aAIjD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc;wBACpB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,wBAAwB;;CAEhE,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAkB;IAC3C,WAAW;CACd,CAAC;AAEF,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAkB;IAC9C,WAAW;CACd,CAAC","sourcesContent":["import Link from \"next/link\";\nimport type {\n ButtonHTMLAttributes,\n HTMLAttributeAnchorTarget,\n MouseEventHandler,\n ReactNode,\n} from \"react\";\nimport styled, { css } from \"styled-components\";\nimport { Color, Spacing, SystemIcon, Typography } from \"../atoms\";\n\nexport type ButtonVariant =\n | \"primary\"\n | \"secondary\"\n | \"tertiary\"\n | \"outline\"\n | \"ghost\"\n | \"text\"\n | \"danger\";\n\nexport type ButtonSize = \"small\" | \"medium\" | \"large\";\n\ntype CustomButtonProps = {\n label?: ReactNode;\n Icon?: SystemIcon.Icon;\n iconRight?: boolean;\n onClick?: MouseEventHandler<HTMLElement>;\n type?: ButtonHTMLAttributes<HTMLButtonElement>[\"type\"];\n disabled?: boolean;\n target?: HTMLAttributeAnchorTarget;\n href?: string;\n};\n\ntype ButtonProps = {\n variant?: ButtonVariant;\n size?: ButtonSize;\n} & CustomButtonProps;\n\nconst Button = ({\n variant = \"primary\",\n size = \"medium\",\n ...restOfProps\n}: ButtonProps) => {\n const variantProps = VARIANT_PROPS_MAP[variant];\n const sizeProps = SIZE_PROPS_MAP[size];\n\n return <RawButton {...variantProps} {...sizeProps} {...restOfProps} />;\n};\n\nexport default Button;\n\ntype VariantStyleProps = {\n defaultColor: Color.DesignColor;\n hoverColor?: Color.DesignColor;\n disabledColor?: Color.DesignColor;\n defaultBackgroundColor: Color.DesignColor;\n hoverBackgroundColor?: Color.DesignColor;\n disabledBackgroundColor?: Color.DesignColor;\n borderColor?: Color.DesignColor;\n textDecoration?: string;\n};\n\nconst VARIANT_PROPS_MAP: { [variant in ButtonVariant]: VariantStyleProps } = {\n primary: {\n defaultColor: Color.typography.whiteHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: Color.brand.grantbiiBlue,\n hoverBackgroundColor: Color.accent.blue2,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n secondary: {\n defaultColor: Color.typography.blackHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: Color.brand.grantbiiYellow,\n hoverBackgroundColor: Color.accent.yellow2,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n tertiary: {\n defaultColor: Color.typography.blackHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: Color.neutral.grey3,\n hoverBackgroundColor: Color.accent.blue3,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n outline: {\n defaultColor: Color.typography.blackHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: \"transparent\",\n hoverBackgroundColor: Color.accent.blue3,\n borderColor: Color.neutral.grey2,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n ghost: {\n defaultColor: Color.typography.blackHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: \"transparent\",\n hoverBackgroundColor: Color.accent.blue3,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n text: {\n defaultColor: Color.typography.blackHigh,\n hoverColor: Color.typography.blackMedium,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: \"transparent\",\n textDecoration: \"underline\",\n },\n danger: {\n defaultColor: Color.typography.whiteHigh,\n disabledColor: Color.typography.blackLow,\n defaultBackgroundColor: Color.accent.red1,\n hoverBackgroundColor: Color.accent.red2,\n disabledBackgroundColor: Color.neutral.grey3,\n },\n};\n\ntype SizeStyleProps = {\n width?: string;\n height?: string;\n padding?: string;\n fontSize?: string;\n};\n\nconst SIZE_PROPS_MAP: { [size in ButtonSize]: SizeStyleProps } = {\n small: {\n height: \"40px\",\n padding: `10px ${Spacing.px16}`, // not following spacing scale\n fontSize: \"14px\",\n },\n medium: {\n height: \"46px\",\n padding: `12px ${Spacing.px16}`, // not following spacing scale\n fontSize: \"16px\",\n },\n large: {\n height: \"52px\",\n padding: `14px ${Spacing.px16}`, // not following spacing scale\n fontSize: \"18px\",\n },\n};\n\ntype RawButtonProps = CustomButtonProps & VariantStyleProps & SizeStyleProps;\n\nexport const RawButton = ({\n Icon,\n iconRight = false,\n label,\n href,\n target,\n disabled,\n type,\n width = \"auto\",\n height = \"46px\",\n padding = `12px ${Spacing.px16}`,\n fontSize = \"16px\",\n textDecoration = \"none\",\n defaultColor,\n hoverColor = defaultColor,\n disabledColor = defaultColor,\n defaultBackgroundColor,\n hoverBackgroundColor = defaultBackgroundColor,\n disabledBackgroundColor = defaultBackgroundColor,\n borderColor,\n ...restOfProps\n}: RawButtonProps) => {\n const isActionIcon = !!Icon && !label;\n\n const styleProps: ButtonStyleProps = {\n $isActionIcon: isActionIcon,\n $width: width,\n $height: height,\n $padding: padding,\n $fontSize: fontSize,\n $textDecoration: textDecoration,\n $defaultColor: defaultColor,\n $hoverColor: hoverColor,\n $disabledColor: disabledColor,\n $defaultBackgroundColor: defaultBackgroundColor,\n $hoverBackgroundColor: hoverBackgroundColor,\n $disabledBackgroundColor: disabledBackgroundColor,\n $borderColor: borderColor,\n };\n\n const content = (\n <>\n {Icon && !iconRight && <Icon size={20} />}\n {label}\n {Icon && iconRight && <Icon size={20} />}\n </>\n );\n\n const isLink = !!href && !disabled;\n\n return isLink ? (\n <BaseLink {...restOfProps} {...styleProps} href={href} target={target}>\n {content}\n </BaseLink>\n ) : (\n <BaseButton\n {...restOfProps}\n {...styleProps}\n disabled={disabled}\n type={type}\n >\n {content}\n </BaseButton>\n );\n};\n\ntype ButtonStyleProps = {\n $isActionIcon: boolean;\n $width: string;\n $height: string;\n $padding: string;\n $fontSize: string;\n $textDecoration: string;\n $defaultColor: Color.DesignColor;\n $hoverColor: Color.DesignColor;\n $disabledColor: Color.DesignColor;\n $defaultBackgroundColor: Color.DesignColor;\n $hoverBackgroundColor: Color.DesignColor;\n $disabledBackgroundColor: Color.DesignColor;\n $borderColor?: Color.DesignColor;\n};\n\nconst ButtonStyle = css<ButtonStyleProps>`\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n gap: ${Spacing.px8};\n\n box-sizing: border-box;\n width: ${(props) => (props.$isActionIcon ? props.$height : props.$width)};\n min-width: ${(props) => (props.$isActionIcon ? props.$height : \"auto\")};\n height: ${(props) => props.$height};\n padding: ${(props) => (props.$isActionIcon ? \"0px\" : props.$padding)};\n\n font-weight: ${Typography.weight.medium};\n font-size: ${(props) => props.$fontSize};\n white-space: nowrap;\n\n color: ${(props) => props.$defaultColor};\n background-color: ${(props) => props.$defaultBackgroundColor};\n\n border: ${(props) =>\n props.$borderColor ? `1px solid ${props.$borderColor}` : \"none\"};\n border-radius: ${Spacing.px8};\n\n text-decoration: ${(props) => props.$textDecoration};\n\n &:hover {\n color: ${(props) => props.$hoverColor};\n background-color: ${(props) => props.$hoverBackgroundColor};\n }\n\n &:disabled {\n color: ${(props) => props.$disabledColor};\n background-color: ${(props) => props.$disabledBackgroundColor};\n }\n`;\n\nconst BaseLink = styled(Link)<ButtonStyleProps>`\n ${ButtonStyle}\n`;\n\nconst BaseButton = styled.button<ButtonStyleProps>`\n ${ButtonStyle}\n`;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as Badge, RawBadge } from "./Badge";
|
|
2
|
-
export { default as Button, RawButton } from "./Button";
|
|
2
|
+
export { default as Button, RawButton, type ButtonSize, type ButtonVariant, } from "./Button";
|
|
3
3
|
export { default as Checkbox } from "./Checkbox";
|
|
4
4
|
export { default as Input } from "./Input";
|
|
5
5
|
export { default as Overlay } from "./Overlay";
|
package/core/molecules/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as Badge, RawBadge } from "./Badge";
|
|
2
|
-
export { default as Button, RawButton } from "./Button";
|
|
2
|
+
export { default as Button, RawButton, } from "./Button";
|
|
3
3
|
export { default as Checkbox } from "./Checkbox";
|
|
4
4
|
export { default as Input } from "./Input";
|
|
5
5
|
export { default as Overlay } from "./Overlay";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/molecules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/molecules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EACL,OAAO,IAAI,MAAM,EACjB,SAAS,GAGV,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { default as Badge, RawBadge } from \"./Badge\";\nexport {\n default as Button,\n RawButton,\n type ButtonSize,\n type ButtonVariant,\n} from \"./Button\";\nexport { default as Checkbox } from \"./Checkbox\";\nexport { default as Input } from \"./Input\";\nexport { default as Overlay } from \"./Overlay\";\nexport { default as PageLoader } from \"./PageLoader\";\nexport { default as RadioButton } from \"./RadioButton\";\nexport { default as Textarea } from \"./Textarea\";\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,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAOvC,MAAM,KAAK,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAc,EAAE,EAAE,CACxD,YAAY,CACV,KAAC,OAAO,sCACN,KAAC,WAAW,cAAS,KAAK,aAAW,MAA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\";\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"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ChangeEventHandler, MouseEventHandler } from "react";
|
|
2
|
+
import { type ButtonVariant } from "../molecules";
|
|
3
|
+
export type SearchBarSize = "small" | "medium";
|
|
2
4
|
type SearchBarProps = {
|
|
3
5
|
queryText: string;
|
|
4
6
|
onChangeQueryText: ChangeEventHandler<HTMLInputElement, HTMLInputElement>;
|
|
@@ -7,9 +9,9 @@ type SearchBarProps = {
|
|
|
7
9
|
handlePressEnter: () => void;
|
|
8
10
|
autoFocus?: boolean;
|
|
9
11
|
disableSearch?: boolean;
|
|
12
|
+
searchButtonVariant?: ButtonVariant;
|
|
10
13
|
placeholder?: string;
|
|
11
14
|
size?: SearchBarSize;
|
|
12
15
|
};
|
|
13
|
-
|
|
14
|
-
declare const SearchBar: ({ queryText, onChangeQueryText, onClickSearch, onClickReset, handlePressEnter, autoFocus, disableSearch, placeholder, size, }: SearchBarProps) => import("react").JSX.Element;
|
|
16
|
+
declare const SearchBar: ({ queryText, onChangeQueryText, onClickSearch, onClickReset, handlePressEnter, autoFocus, disableSearch, searchButtonVariant, placeholder, size, }: SearchBarProps) => import("react").JSX.Element;
|
|
15
17
|
export default SearchBar;
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { Color, Responsive, Spacing, SystemIcon } from "../atoms";
|
|
4
4
|
import { Button } from "../molecules";
|
|
5
|
-
const SearchBar = ({ queryText, onChangeQueryText, onClickSearch, onClickReset, handlePressEnter, autoFocus = false, disableSearch = false, placeholder = "Search grant or describe your project", size = "medium", }) => {
|
|
5
|
+
const SearchBar = ({ queryText, onChangeQueryText, onClickSearch, onClickReset, handlePressEnter, autoFocus = false, disableSearch = false, searchButtonVariant = "primary", placeholder = "Search grant or describe your project", size = "medium", }) => {
|
|
6
6
|
const { height, fontSize } = sizePropsMap[size];
|
|
7
|
-
return (_jsxs(BaseSearchBar, { children: [_jsxs(SearchArea, { "$height": height, "$hasQueryText": queryText !== "", children: [_jsx(TextInput, { queryText: queryText, onChangeQueryText: onChangeQueryText, handlePressEnter: handlePressEnter, autoFocus: autoFocus, disableSearch: disableSearch, placeholder: placeholder, fontSize: fontSize }), queryText === "" ? (_jsx(ResetButtonPlaceholder, {})) : (_jsx(ResetButton, { onClickReset: onClickReset }))] }), _jsx(Button, { disabled: disableSearch, Icon: SystemIcon.MagnifyingGlassIcon,
|
|
7
|
+
return (_jsxs(BaseSearchBar, { children: [_jsxs(SearchArea, { "$height": height, "$hasQueryText": queryText !== "", children: [_jsx(TextInput, { queryText: queryText, onChangeQueryText: onChangeQueryText, handlePressEnter: handlePressEnter, autoFocus: autoFocus, disableSearch: disableSearch, placeholder: placeholder, fontSize: fontSize }), queryText === "" ? (_jsx(ResetButtonPlaceholder, {})) : (_jsx(ResetButton, { onClickReset: onClickReset }))] }), _jsx(Button, { onClick: onClickSearch, disabled: disableSearch, Icon: SystemIcon.MagnifyingGlassIcon, variant: searchButtonVariant, size: size })] }));
|
|
8
8
|
};
|
|
9
9
|
export default SearchBar;
|
|
10
10
|
const sizePropsMap = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../../../core/organisms/SearchBar.tsx"],"names":[],"mappings":";AAKA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SearchBar.js","sourceRoot":"","sources":["../../../core/organisms/SearchBar.tsx"],"names":[],"mappings":";AAKA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,MAAM,EAAsB,MAAM,cAAc,CAAC;AAiB1D,MAAM,SAAS,GAAG,CAAC,EACjB,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,SAAS,GAAG,KAAK,EACjB,aAAa,GAAG,KAAK,EACrB,mBAAmB,GAAG,SAAS,EAC/B,WAAW,GAAG,uCAAuC,EACrD,IAAI,GAAG,QAAQ,GACA,EAAE,EAAE;IACnB,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,Y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AAI,EAAC,QAAQ,YACnD,KAAC,UAAU,CAAC,KAAK,IAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,GAAI,GAC1C,CACnB,CAAC;AAEF,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;;;;mBASlB,OAAO,CAAC,GAAG;CAC7B,CAAC;AAEF,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;mBAItB,OAAO,CAAC,GAAG;CAC7B,CAAC","sourcesContent":["import type {\n ChangeEventHandler,\n KeyboardEvent,\n MouseEventHandler,\n} from \"react\";\nimport styled from \"styled-components\";\nimport { Color, Responsive, Spacing, SystemIcon } from \"../atoms\";\nimport { Button, type ButtonVariant } from \"../molecules\";\n\nexport type SearchBarSize = \"small\" | \"medium\";\n\ntype SearchBarProps = {\n queryText: string;\n onChangeQueryText: ChangeEventHandler<HTMLInputElement, HTMLInputElement>;\n onClickReset: MouseEventHandler<HTMLButtonElement>;\n onClickSearch: MouseEventHandler<HTMLButtonElement>;\n handlePressEnter: () => void;\n autoFocus?: boolean;\n disableSearch?: boolean;\n searchButtonVariant?: ButtonVariant;\n placeholder?: string;\n size?: SearchBarSize;\n};\n\nconst SearchBar = ({\n queryText,\n onChangeQueryText,\n onClickSearch,\n onClickReset,\n handlePressEnter,\n autoFocus = false,\n disableSearch = false,\n searchButtonVariant = \"primary\",\n placeholder = \"Search grant or describe your project\",\n size = \"medium\",\n}: SearchBarProps) => {\n const { height, fontSize } = sizePropsMap[size];\n\n return (\n <BaseSearchBar>\n <SearchArea $height={height} $hasQueryText={queryText !== \"\"}>\n <TextInput\n queryText={queryText}\n onChangeQueryText={onChangeQueryText}\n handlePressEnter={handlePressEnter}\n autoFocus={autoFocus}\n disableSearch={disableSearch}\n placeholder={placeholder}\n fontSize={fontSize}\n />\n\n {queryText === \"\" ? (\n <ResetButtonPlaceholder />\n ) : (\n <ResetButton onClickReset={onClickReset} />\n )}\n </SearchArea>\n\n <Button\n onClick={onClickSearch}\n disabled={disableSearch}\n Icon={SystemIcon.MagnifyingGlassIcon}\n variant={searchButtonVariant}\n size={size}\n />\n </BaseSearchBar>\n );\n};\n\nexport default SearchBar;\n\ntype SizeStyleProps = {\n height: string;\n fontSize: string;\n};\n\nconst sizePropsMap: { [size in SearchBarSize]: SizeStyleProps } = {\n small: {\n height: Spacing.px40,\n fontSize: \"12px\",\n },\n medium: {\n height: \"44px\",\n fontSize: \"14px\",\n },\n};\n\nconst BaseSearchBar = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ${Spacing.px8};\n\n width: 100%;\n\n @media (width < ${Responsive.widthBreakpoint.laptop}) {\n border-radius: 0px;\n }\n\n @media (width >= ${Responsive.widthBreakpoint.laptop}) {\n border-radius: ${Spacing.px12};\n }\n`;\n\ntype SearchAreaProps = {\n $height: string;\n $hasQueryText: boolean;\n};\n\nconst SearchArea = styled.div<SearchAreaProps>`\n display: flex;\n align-items: center;\n\n box-sizing: border-box;\n height: ${(props) => props.$height};\n width: 100%;\n\n background-color: ${(props) =>\n props.$hasQueryText ? Color.neutral.white : Color.neutral.grey4};\n border: 0.5px solid\n ${(props) =>\n props.$hasQueryText ? Color.accent.yellow1 : Color.neutral.grey2};\n border-radius: ${Spacing.px8};\n\n &:focus-within {\n background-color: ${Color.neutral.white};\n border: 0.5px solid ${Color.accent.yellow1};\n }\n`;\n\ntype TextInputProps = {\n queryText: string;\n onChangeQueryText?: ChangeEventHandler<HTMLInputElement, HTMLInputElement>;\n handlePressEnter: () => void;\n autoFocus: boolean;\n disableSearch: boolean;\n placeholder: string;\n fontSize: string;\n};\n\nconst TextInput = ({\n queryText,\n onChangeQueryText,\n handlePressEnter,\n autoFocus,\n disableSearch,\n placeholder,\n fontSize,\n}: TextInputProps) => {\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Enter\" && !event.repeat && !disableSearch) {\n event.preventDefault();\n handlePressEnter();\n }\n };\n\n return (\n <BaseTextInput\n value={queryText}\n placeholder={placeholder}\n onChange={onChangeQueryText}\n onKeyDown={onKeyDown}\n autoFocus={autoFocus}\n $fontSize={fontSize}\n />\n );\n};\n\nconst BaseTextInput = styled.input<{ $fontSize: string }>`\n width: 100%;\n margin-left: ${Spacing.px16};\n\n font-size: ${(props) => props.$fontSize};\n text-overflow: ellipsis;\n\n background-color: transparent;\n outline: none;\n border: none;\n`;\n\ntype ResetButtonProps = {\n onClickReset: MouseEventHandler<HTMLButtonElement>;\n};\n\nconst ResetButton = ({ onClickReset }: ResetButtonProps) => (\n <BaseResetButton onClick={onClickReset} type=\"button\">\n <SystemIcon.XIcon size={14} color={Color.neutral.black} />\n </BaseResetButton>\n);\n\nconst BaseResetButton = styled.button`\n display: flex;\n align-items: center;\n justify-content: center;\n\n width: 38px;\n min-width: 38px;\n height: 38px;\n\n border-radius: ${Spacing.px8};\n`;\n\nconst ResetButtonPlaceholder = styled.div`\n width: 38px;\n height: 38px;\n\n border-radius: ${Spacing.px8};\n`;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as Dropdown, type DropdownProps } from "./Dropdown";
|
|
2
2
|
export { default as FileDrop, useFileDrop } from "./FileDrop";
|
|
3
3
|
export { default as Modal, useModal } from "./Modal";
|
|
4
|
-
export { default as SearchBar } from "./SearchBar";
|
|
4
|
+
export { default as SearchBar, type SearchBarSize } from "./SearchBar";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/organisms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAsB,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/organisms/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAsB,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAsB,MAAM,aAAa,CAAC","sourcesContent":["export { default as Dropdown, type DropdownProps } from \"./Dropdown\";\nexport { default as FileDrop, useFileDrop } from \"./FileDrop\";\nexport { default as Modal, useModal } from \"./Modal\";\nexport { default as SearchBar, type SearchBarSize } from \"./SearchBar\";\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,EA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,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,gBAAgB,CAAC;AACpC,MAAM,mBAAmB,GACvB,wGAAwG,CAAC;AAE3G,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;SAGrB,OAAO,CAAC,IAAI;;;;gBAIL,OAAO,CAAC,KAAK;;aAEhB,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,IAAI;;CAEvC,CAAC;AAEF,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAG/B,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGhC,CAAC;AAQF,MAAM,WAAW,GAAG,CAAC,EACnB,KAAK,EACL,WAAW,EACX,YAAY,GACK,EAAE,EAAE;IACrB,MAAM,EAAE,SAAS,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC7C,MAAM,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"]}
|