@grantbii/design-system 1.18.2 → 1.19.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/index.d.ts +0 -1
- package/core/archive/index.js +0 -1
- package/core/archive/index.js.map +1 -1
- package/core/atoms/Color.d.ts +45 -0
- package/core/atoms/Color.js +6 -0
- package/core/atoms/Color.js.map +1 -1
- package/core/atoms/Responsive.js +1 -0
- package/core/atoms/Responsive.js.map +1 -1
- package/core/molecules/Button.d.ts +36 -12
- package/core/molecules/Button.js +139 -5
- package/core/molecules/Button.js.map +1 -1
- package/core/organisms/GrantMatch/ActiveQueryFiles.js +2 -2
- package/core/organisms/GrantMatch/ActiveQueryFiles.js.map +1 -1
- package/core/organisms/GrantMatch/GrantMatchModal.js +1 -2
- package/core/organisms/GrantMatch/GrantMatchModal.js.map +1 -1
- package/core/organisms/Modal.js +1 -1
- package/core/organisms/Modal.js.map +1 -1
- package/core/shared.d.ts +0 -13
- package/core/shared.js +0 -23
- package/core/shared.js.map +1 -1
- package/core/templates/ErrorFallback.js +1 -1
- package/core/templates/ErrorFallback.js.map +1 -1
- package/package.json +1 -1
- package/stories/molecules/Button.stories.d.ts +21 -3
- package/stories/molecules/Button.stories.js +149 -31
- package/stories/molecules/Button.stories.js.map +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/core/archive/LinkButton.d.ts +0 -20
- package/core/archive/LinkButton.js +0 -23
- package/core/archive/LinkButton.js.map +0 -1
- package/stories/archive/LinkButton.stories.d.ts +0 -10
- package/stories/archive/LinkButton.stories.js +0 -41
- package/stories/archive/LinkButton.stories.js.map +0 -1
package/core/archive/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as Badges } from "./Badges";
|
|
2
|
-
export { default as LinkButton } from "./LinkButton";
|
|
3
2
|
export { default as LocationIcon } from "./LocationIcon";
|
|
4
3
|
export { default as RadioButtons, type RadioOption } from "./RadioButtons";
|
|
5
4
|
export { default as TallyModal } from "./TallyModal";
|
package/core/archive/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { default as Badges } from "./Badges";
|
|
2
|
-
export { default as LinkButton } from "./LinkButton";
|
|
3
2
|
export { default as LocationIcon } from "./LocationIcon";
|
|
4
3
|
export { default as RadioButtons } from "./RadioButtons";
|
|
5
4
|
export { default as TallyModal } from "./TallyModal";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/archive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../core/archive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default as Badges } from \"./Badges\";\nexport { default as LocationIcon } from \"./LocationIcon\";\nexport { default as RadioButtons, type RadioOption } from \"./RadioButtons\";\nexport { default as TallyModal } from \"./TallyModal\";\nexport { default as YesNoOptions } from \"./YesNoOptions\";\n"]}
|
package/core/atoms/Color.d.ts
CHANGED
|
@@ -36,3 +36,48 @@ export declare const accent: {
|
|
|
36
36
|
readonly blue3: "#ECF5FF";
|
|
37
37
|
readonly blue4: "#F5F9FF";
|
|
38
38
|
};
|
|
39
|
+
declare const allColors: {
|
|
40
|
+
readonly brand: {
|
|
41
|
+
readonly grantbiiYellow: "#EBA338";
|
|
42
|
+
readonly grantbiiBlue: "#16538A";
|
|
43
|
+
};
|
|
44
|
+
readonly neutral: {
|
|
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
|
+
};
|
|
78
|
+
};
|
|
79
|
+
type ValueOf<T> = T[keyof T];
|
|
80
|
+
export type DesignColor = ValueOf<{
|
|
81
|
+
[K in keyof typeof allColors]: ValueOf<(typeof allColors)[K]>;
|
|
82
|
+
}>;
|
|
83
|
+
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;IAChB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;CACR,CAAC;AAEX,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,SAAS;IACnB,SAAS,EAAE,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"]}
|
|
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;IAChB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;CACR,CAAC;AAEX,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,SAAS;IACnB,SAAS,EAAE,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;AAEX,MAAM,SAAS,GAAG;IAChB,KAAK;IACL,OAAO;IACP,UAAU;IACV,MAAM;CACE,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\nconst allColors = {\n brand,\n neutral,\n typography,\n accent,\n} as const;\n\ntype ValueOf<T> = T[keyof T];\n\nexport type DesignColor = ValueOf<{\n [K in keyof typeof allColors]: ValueOf<(typeof allColors)[K]>;\n}>;\n"]}
|
package/core/atoms/Responsive.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Responsive.js","sourceRoot":"","sources":["../../../core/atoms/Responsive.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE,QAAQ;CACjB,CAAC","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Responsive.js","sourceRoot":"","sources":["../../../core/atoms/Responsive.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE,QAAQ;CACjB,CAAC","sourcesContent":["// TODO: refactor\nexport const WIDTH_BREAKPOINTS = {\n laptop: \"1024px\",\n};\n"]}
|
|
@@ -1,14 +1,38 @@
|
|
|
1
|
-
import type { ButtonHTMLAttributes,
|
|
2
|
-
import { SystemIcon } from "../atoms";
|
|
1
|
+
import type { ButtonHTMLAttributes, HTMLAttributeAnchorTarget, MouseEventHandler, ReactNode } from "react";
|
|
2
|
+
import { Color, SystemIcon } from "../atoms";
|
|
3
|
+
type ButtonVariant = "primary" | "secondary" | "tertiary" | "outline" | "ghost" | "text" | "danger";
|
|
4
|
+
type ButtonSize = "small" | "medium" | "large";
|
|
3
5
|
type ButtonProps = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
backgroundColor?: string;
|
|
9
|
-
borderColor?: string;
|
|
10
|
-
color?: string;
|
|
11
|
-
width?: string;
|
|
12
|
-
} & DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
|
|
13
|
-
declare const Button: ({ label, LeftIcon, RightIcon, underline, backgroundColor, borderColor, color, width, type, ...buttonProps }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
} & CustomButtonProps;
|
|
9
|
+
declare const Button: ({ variant, size, ...restOfProps }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
10
|
export default Button;
|
|
11
|
+
type VariantStyleProps = {
|
|
12
|
+
defaultColor: Color.DesignColor;
|
|
13
|
+
hoverColor?: Color.DesignColor;
|
|
14
|
+
disabledColor?: Color.DesignColor;
|
|
15
|
+
defaultBackgroundColor: Color.DesignColor;
|
|
16
|
+
hoverBackgroundColor?: Color.DesignColor;
|
|
17
|
+
disabledBackgroundColor?: Color.DesignColor;
|
|
18
|
+
borderColor?: Color.DesignColor;
|
|
19
|
+
textDecoration?: string;
|
|
20
|
+
};
|
|
21
|
+
type SizeStyleProps = {
|
|
22
|
+
height: string;
|
|
23
|
+
fontSize: string;
|
|
24
|
+
lineHeight: string;
|
|
25
|
+
padding: string;
|
|
26
|
+
};
|
|
27
|
+
type CustomButtonProps = {
|
|
28
|
+
label?: ReactNode;
|
|
29
|
+
Icon?: SystemIcon.Icon;
|
|
30
|
+
iconRight?: boolean;
|
|
31
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
32
|
+
type?: ButtonHTMLAttributes<HTMLButtonElement>["type"];
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
target?: HTMLAttributeAnchorTarget;
|
|
35
|
+
href?: string;
|
|
36
|
+
};
|
|
37
|
+
type RawButtonProps = CustomButtonProps & VariantStyleProps & SizeStyleProps;
|
|
38
|
+
export declare const RawButton: ({ Icon, iconRight, label, href, target, disabled, type, height, padding, fontSize, lineHeight, textDecoration, defaultColor, hoverColor, disabledColor, defaultBackgroundColor, hoverBackgroundColor, disabledBackgroundColor, borderColor, ...restOfProps }: RawButtonProps) => import("react/jsx-runtime").JSX.Element;
|
package/core/molecules/Button.js
CHANGED
|
@@ -1,10 +1,144 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
const Button = ({
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
|
+
import { Color, Spacing, SystemIcon, Typography } from "../atoms";
|
|
5
|
+
const Button = ({ variant = "primary", size = "medium", ...restOfProps }) => {
|
|
6
|
+
const variantProps = VARIANT_PROPS_MAP[variant];
|
|
7
|
+
const sizeProps = SIZE_PROPS_MAP[size];
|
|
8
|
+
return _jsx(RawButton, { ...variantProps, ...sizeProps, ...restOfProps });
|
|
9
|
+
};
|
|
6
10
|
export default Button;
|
|
11
|
+
const VARIANT_PROPS_MAP = {
|
|
12
|
+
primary: {
|
|
13
|
+
defaultColor: Color.typography.whiteHigh,
|
|
14
|
+
disabledColor: Color.typography.blackLow,
|
|
15
|
+
defaultBackgroundColor: Color.brand.grantbiiBlue,
|
|
16
|
+
hoverBackgroundColor: Color.accent.blue2,
|
|
17
|
+
disabledBackgroundColor: Color.neutral.grey3,
|
|
18
|
+
},
|
|
19
|
+
secondary: {
|
|
20
|
+
defaultColor: Color.typography.blackHigh,
|
|
21
|
+
disabledColor: Color.typography.blackLow,
|
|
22
|
+
defaultBackgroundColor: Color.brand.grantbiiYellow,
|
|
23
|
+
hoverBackgroundColor: Color.accent.yellow2,
|
|
24
|
+
disabledBackgroundColor: Color.neutral.grey3,
|
|
25
|
+
},
|
|
26
|
+
tertiary: {
|
|
27
|
+
defaultColor: Color.typography.blackHigh,
|
|
28
|
+
disabledColor: Color.typography.blackLow,
|
|
29
|
+
defaultBackgroundColor: Color.neutral.grey3,
|
|
30
|
+
hoverBackgroundColor: Color.accent.blue3,
|
|
31
|
+
disabledBackgroundColor: Color.neutral.grey3,
|
|
32
|
+
},
|
|
33
|
+
outline: {
|
|
34
|
+
defaultColor: Color.typography.blackHigh,
|
|
35
|
+
disabledColor: Color.typography.blackLow,
|
|
36
|
+
defaultBackgroundColor: Color.neutral.white,
|
|
37
|
+
hoverBackgroundColor: Color.accent.blue3,
|
|
38
|
+
borderColor: Color.neutral.grey2,
|
|
39
|
+
disabledBackgroundColor: Color.neutral.grey3,
|
|
40
|
+
},
|
|
41
|
+
ghost: {
|
|
42
|
+
defaultColor: Color.typography.blackHigh,
|
|
43
|
+
disabledColor: Color.typography.blackLow,
|
|
44
|
+
defaultBackgroundColor: Color.neutral.white,
|
|
45
|
+
hoverBackgroundColor: Color.accent.blue3,
|
|
46
|
+
disabledBackgroundColor: Color.neutral.grey3,
|
|
47
|
+
},
|
|
48
|
+
text: {
|
|
49
|
+
defaultColor: Color.typography.blackHigh,
|
|
50
|
+
hoverColor: Color.typography.blackMedium,
|
|
51
|
+
disabledColor: Color.typography.blackLow,
|
|
52
|
+
defaultBackgroundColor: Color.neutral.white,
|
|
53
|
+
textDecoration: "underline",
|
|
54
|
+
},
|
|
55
|
+
danger: {
|
|
56
|
+
defaultColor: Color.typography.whiteHigh,
|
|
57
|
+
disabledColor: Color.typography.blackLow,
|
|
58
|
+
defaultBackgroundColor: Color.accent.red1,
|
|
59
|
+
hoverBackgroundColor: Color.accent.red2,
|
|
60
|
+
disabledBackgroundColor: Color.neutral.grey3,
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
const SIZE_PROPS_MAP = {
|
|
64
|
+
small: {
|
|
65
|
+
height: "40px",
|
|
66
|
+
padding: "10px", // not following spacing scale
|
|
67
|
+
fontSize: "14px",
|
|
68
|
+
lineHeight: "100%",
|
|
69
|
+
},
|
|
70
|
+
medium: {
|
|
71
|
+
height: "46px",
|
|
72
|
+
padding: "12px", // not following spacing scale
|
|
73
|
+
fontSize: "16px",
|
|
74
|
+
lineHeight: "100%",
|
|
75
|
+
},
|
|
76
|
+
large: {
|
|
77
|
+
height: "52px",
|
|
78
|
+
padding: "14px", // not following spacing scale
|
|
79
|
+
fontSize: "18px",
|
|
80
|
+
lineHeight: "24px",
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
export const RawButton = ({ Icon, iconRight = false, label, href, target, disabled, type, height, padding, fontSize, lineHeight, textDecoration = "none", defaultColor, hoverColor = defaultColor, disabledColor = defaultColor, defaultBackgroundColor, hoverBackgroundColor = defaultBackgroundColor, disabledBackgroundColor = defaultBackgroundColor, borderColor, ...restOfProps }) => {
|
|
84
|
+
const isActionIcon = !!Icon && !label;
|
|
85
|
+
const styleProps = {
|
|
86
|
+
$isActionIcon: isActionIcon,
|
|
87
|
+
$height: height,
|
|
88
|
+
$fontSize: fontSize,
|
|
89
|
+
$lineHeight: lineHeight,
|
|
90
|
+
$padding: padding,
|
|
91
|
+
$textDecoration: textDecoration,
|
|
92
|
+
$defaultColor: defaultColor,
|
|
93
|
+
$hoverColor: hoverColor,
|
|
94
|
+
$disabledColor: disabledColor,
|
|
95
|
+
$defaultBackgroundColor: defaultBackgroundColor,
|
|
96
|
+
$hoverBackgroundColor: hoverBackgroundColor,
|
|
97
|
+
$disabledBackgroundColor: disabledBackgroundColor,
|
|
98
|
+
$borderColor: borderColor,
|
|
99
|
+
};
|
|
100
|
+
const content = (_jsxs(_Fragment, { children: [Icon && !iconRight && _jsx(Icon, { size: 20 }), label, Icon && iconRight && _jsx(Icon, { size: 20 })] }));
|
|
101
|
+
const isLink = !!href && !disabled;
|
|
102
|
+
return isLink ? (_jsx(BaseLink, { ...restOfProps, ...styleProps, href: href, target: target, children: content })) : (_jsx(BaseButton, { ...restOfProps, ...styleProps, disabled: disabled, type: type, children: content }));
|
|
103
|
+
};
|
|
104
|
+
const ButtonStyle = css `
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: row;
|
|
107
|
+
align-items: center;
|
|
108
|
+
gap: ${Spacing.px8};
|
|
109
|
+
|
|
110
|
+
box-sizing: border-box;
|
|
111
|
+
width: ${(props) => (props.$isActionIcon ? props.$height : "auto")};
|
|
112
|
+
height: ${(props) => props.$height};
|
|
113
|
+
padding: ${(props) => props.$isActionIcon ? props.$padding : `${props.$padding} ${Spacing.px16}`};
|
|
114
|
+
|
|
115
|
+
font-weight: ${Typography.weight.medium};
|
|
116
|
+
font-size: ${(props) => props.$fontSize};
|
|
117
|
+
line-height: ${(props) => props.$lineHeight};
|
|
118
|
+
white-space: nowrap;
|
|
119
|
+
|
|
120
|
+
color: ${(props) => props.$defaultColor};
|
|
121
|
+
background-color: ${(props) => props.$defaultBackgroundColor};
|
|
122
|
+
|
|
123
|
+
border: ${(props) => props.$borderColor ? `1px solid ${props.$borderColor}` : "none"};
|
|
124
|
+
border-radius: ${Spacing.px8};
|
|
125
|
+
|
|
126
|
+
text-decoration: ${(props) => props.$textDecoration};
|
|
127
|
+
|
|
128
|
+
&:hover {
|
|
129
|
+
color: ${(props) => props.$hoverColor};
|
|
130
|
+
background-color: ${(props) => props.$hoverBackgroundColor};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&:disabled {
|
|
134
|
+
color: ${(props) => props.$disabledColor};
|
|
135
|
+
background-color: ${(props) => props.$disabledBackgroundColor};
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
const BaseLink = styled(Link) `
|
|
139
|
+
${ButtonStyle}
|
|
140
|
+
`;
|
|
7
141
|
const BaseButton = styled.button `
|
|
8
|
-
|
|
142
|
+
${ButtonStyle}
|
|
9
143
|
`;
|
|
10
144
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../core/molecules/Button.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AAgBxD,MAAM,MAAM,GAAG,CAAC,EACd,KAAK,EACL,QAAQ,EACR,SAAS,EACT,SAAS,EACT,eAAe,EACf,WAAW,EACX,KAAK,EACL,KAAK,EACL,IAAI,GAAG,QAAQ,EACf,GAAG,WAAW,EACF,EAAE,EAAE,CAAC,CACjB,KAAC,UAAU,OAAK,WAAW,EAAE,IAAI,EAAE,IAAI,YAAU,KAAK,YACpD,MAAC,aAAa,kBACA,SAAS,sBACH,eAAe,kBACnB,WAAW,YACjB,KAAK,YACL,KAAK,aAEZ,QAAQ,CAAC,CAAC,CAAC,KAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC,mBAAK,EACvD,KAAK,EACL,SAAS,CAAC,CAAC,CAAC,KAAC,SAAS,IAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,GAAI,CAAC,CAAC,CAAC,mBAAK,IAC5C,GACL,CACd,CAAC;AAEF,eAAe,MAAM,CAAC;AAEtB,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAqB;WAC1C,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM;CACzC,CAAC","sourcesContent":["import type { ButtonHTMLAttributes, DetailedHTMLProps, ReactNode } from \"react\";\nimport styled from \"styled-components\";\nimport { SystemIcon } from \"../atoms\";\nimport { BaseButton as ButtonContent } from \"../shared\";\n\ntype ButtonProps = {\n label: ReactNode;\n LeftIcon?: SystemIcon.Icon;\n RightIcon?: SystemIcon.Icon;\n underline?: boolean;\n backgroundColor?: string;\n borderColor?: string;\n color?: string;\n width?: string;\n} & DetailedHTMLProps<\n ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n>;\n\nconst Button = ({\n label,\n LeftIcon,\n RightIcon,\n underline,\n backgroundColor,\n borderColor,\n color,\n width,\n type = \"button\",\n ...buttonProps\n}: ButtonProps) => (\n <BaseButton {...buttonProps} type={type} $width={width}>\n <ButtonContent\n $underline={underline}\n $backgroundColor={backgroundColor}\n $borderColor={borderColor}\n $color={color}\n $width={width}\n >\n {LeftIcon ? <LeftIcon color={color} size={20} /> : <></>}\n {label}\n {RightIcon ? <RightIcon color={color} size={20} /> : <></>}\n </ButtonContent>\n </BaseButton>\n);\n\nexport default Button;\n\nconst BaseButton = styled.button<{ $width?: string }>`\n width: ${({ $width = \"auto\" }) => $width};\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,MAAM,UAAU,CAAC;AAkBlE,MAAM,MAAM,GAAG,CAAC,EACd,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,QAAQ,EACf,GAAG,WAAW,EACF,EAAE,EAAE;IAChB,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAEvC,OAAO,KAAC,SAAS,OAAK,YAAY,KAAM,SAAS,KAAM,WAAW,GAAI,CAAC;AACzE,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC;AAatB,MAAM,iBAAiB,GAAsD;IAC3E,OAAO,EAAE;QACP,YAAY,EAAE,KAAK,CAAC,UAAU,CAAC,SAAS;QACxC,aAAa,EAAE,KAAK,CAAC,UAAU,CAAC,QAAQ;QACxC,sBAAsB,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY;QAChD,oBAAoB,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;QACxC,uBAAuB,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;KAC7C;IACD,SAAS,EAAE;QACT,YAAY,EAAE,KAAK,CAAC,UAAU,CAAC,SAAS;QACxC,aAAa,EAAE,KAAK,CAAC,UAAU,CAAC,QAAQ;QAC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Aa,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE;;iBAE7D,UAAU,CAAC,MAAM,CAAC,MAAM;eAC1B,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS;iBACxB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW;;;WAGlC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa;sBACnB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,uBAAuB;;YAElD,CAAC,KAAK,EAAE,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\ntype ButtonVariant =\n | \"primary\"\n | \"secondary\"\n | \"tertiary\"\n | \"outline\"\n | \"ghost\"\n | \"text\"\n | \"danger\";\n\ntype ButtonSize = \"small\" | \"medium\" | \"large\";\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: Color.neutral.white,\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: Color.neutral.white,\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: Color.neutral.white,\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 height: string;\n fontSize: string;\n lineHeight: string;\n padding: string;\n};\n\nconst SIZE_PROPS_MAP: { [size in ButtonSize]: SizeStyleProps } = {\n small: {\n height: \"40px\",\n padding: \"10px\", // not following spacing scale\n fontSize: \"14px\",\n lineHeight: \"100%\",\n },\n medium: {\n height: \"46px\",\n padding: \"12px\", // not following spacing scale\n fontSize: \"16px\",\n lineHeight: \"100%\",\n },\n large: {\n height: \"52px\",\n padding: \"14px\", // not following spacing scale\n fontSize: \"18px\",\n lineHeight: \"24px\",\n },\n};\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 RawButtonProps = CustomButtonProps & VariantStyleProps & SizeStyleProps;\n\nexport const RawButton = ({\n Icon,\n iconRight = false,\n label,\n href,\n target,\n disabled,\n type,\n height,\n padding,\n fontSize,\n lineHeight,\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 $height: height,\n $fontSize: fontSize,\n $lineHeight: lineHeight,\n $padding: padding,\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 $height: string;\n $padding: string;\n $fontSize: string;\n $lineHeight: 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 align-items: center;\n gap: ${Spacing.px8};\n\n box-sizing: border-box;\n width: ${(props) => (props.$isActionIcon ? props.$height : \"auto\")};\n height: ${(props) => props.$height};\n padding: ${(props) =>\n props.$isActionIcon ? props.$padding : `${props.$padding} ${Spacing.px16}`};\n\n font-weight: ${Typography.weight.medium};\n font-size: ${(props) => props.$fontSize};\n line-height: ${(props) => props.$lineHeight};\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,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import {
|
|
3
|
+
import { SystemIcon } from "../../atoms";
|
|
4
4
|
import { Badge, Button } from "../../molecules";
|
|
5
5
|
import { FILE_TYPE_ICON_MAP } from "../../shared";
|
|
6
6
|
import { useGrantMatchContext } from "./context";
|
|
@@ -42,6 +42,6 @@ const BaseFileBadges = styled.div `
|
|
|
42
42
|
`;
|
|
43
43
|
const ResetFilesButton = () => {
|
|
44
44
|
const { activeQuery, updateActiveQuery } = useGrantMatchContext();
|
|
45
|
-
return (_jsx(Button, { label: "Reset", onClick: () => updateActiveQuery({ files: [], text: activeQuery.text }),
|
|
45
|
+
return (_jsx(Button, { label: "Reset", onClick: () => updateActiveQuery({ files: [], text: activeQuery.text }), variant: "text" }));
|
|
46
46
|
};
|
|
47
47
|
//# sourceMappingURL=ActiveQueryFiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActiveQueryFiles.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/ActiveQueryFiles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ActiveQueryFiles.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/ActiveQueryFiles.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,mBAAmB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AI,CAAC,IAAI,CAAC,EACpD,gBAAgB,EAAE,GAAG,IAJhB,IAAI,CAAC,IAAI,CAKd,CACH,CAAC,GACa,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;CAiBhC,CAAC;AAEF,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC5B,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAElE,OAAO,CACL,KAAC,MAAM,IACL,KAAK,EAAC,OAAO,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,EACvE,OAAO,EAAC,MAAM,GACd,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import styled from \"styled-components\";\nimport { SystemIcon } from \"../../atoms\";\nimport { Badge, Button } from \"../../molecules\";\nimport { FILE_TYPE_ICON_MAP } from \"../../shared\";\nimport { useGrantMatchContext } from \"./context\";\n\nconst ActiveQueryFiles = () => (\n <BaseActiveFiles>\n <FileBadges />\n <ResetFilesButton />\n </BaseActiveFiles>\n);\n\nexport default ActiveQueryFiles;\n\nconst BaseActiveFiles = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n`;\n\nconst FileBadges = () => {\n const { activeQuery, updateActiveQuery } = useGrantMatchContext();\n\n const removeActiveQueryFile = (fileName: string) => {\n const newQuery = {\n files: activeQuery.files.filter((file) => file.name !== fileName),\n text: activeQuery.text,\n };\n\n updateActiveQuery(newQuery);\n };\n\n return (\n <BaseFileBadges>\n {activeQuery.files.map((file) => (\n <Badge\n key={file.name}\n label={file.name.substring(0, file.name.lastIndexOf(\".\"))}\n Icon={FILE_TYPE_ICON_MAP[file.type] ?? SystemIcon.FileIcon}\n onClickClose={() => removeActiveQueryFile(file.name)}\n labelWidthPixels={160}\n />\n ))}\n </BaseFileBadges>\n );\n};\n\nconst BaseFileBadges = styled.div`\n display: flex;\n align-items: center;\n gap: 8px;\n\n width: 100%;\n\n overflow-x: auto;\n\n /* hide scrollbar but still allow for scrolling */\n -ms-overflow-style: none;\n scrollbar-width: none;\n ::-webkit-scrollbar {\n display: none;\n }\n\n /* TODO: fade effect on overflow-x */\n`;\n\nconst ResetFilesButton = () => {\n const { activeQuery, updateActiveQuery } = useGrantMatchContext();\n\n return (\n <Button\n label=\"Reset\"\n onClick={() => updateActiveQuery({ files: [], text: activeQuery.text })}\n variant=\"text\"\n />\n );\n};\n"]}
|
|
@@ -2,7 +2,6 @@ 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 } from "../../atoms";
|
|
6
5
|
import { Button, Textarea } from "../../molecules";
|
|
7
6
|
import FileDrop, { useFileDrop } from "../../organisms/FileDrop";
|
|
8
7
|
import Modal from "../../organisms/Modal";
|
|
@@ -60,6 +59,6 @@ const FindGrantsButton = ({ files, findGrantsCallback, }) => {
|
|
|
60
59
|
updateActiveQuery({ files, text: queryText });
|
|
61
60
|
closeModal();
|
|
62
61
|
};
|
|
63
|
-
return (_jsx(Button, { label: "Find My Grants", onClick: onClick,
|
|
62
|
+
return (_jsx(Button, { label: "Find My Grants", onClick: onClick, variant: "secondary", disabled: !hasQuery }));
|
|
64
63
|
};
|
|
65
64
|
//# sourceMappingURL=GrantMatchModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrantMatchModal.js","sourceRoot":"","sources":["../../../../core/organisms/GrantMatch/GrantMatchModal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,cAAc,MAAM,0CAA0C,CAAC;A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G,MAAM,CAAC,GAAG,CAAA;;;CAGhC,CAAC;AAOF,MAAM,gBAAgB,GAAG,CAAC,EACxB,KAAK,EACL,kBAAkB,GACI,EAAE,EAAE;IAC1B,MAAM,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC5E,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAE7D,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,IAAI,kBAAkB,EAAE,CAAC;YACvB,kBAAkB,EAAE,CAAC;QACvB,CAAC;QAED,iBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;QAC9C,UAAU,EAAE,CAAC;IACf,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,IACL,KAAK,EAAC,gBAAgB,EACtB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAC,WAAW,EACnB,QAAQ,EAAE,CAAC,QAAQ,GACnB,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import Image from \"next/image\";\nimport styled from \"styled-components\";\nimport grantMatchLogo from \"../../assets/logos/grant_match_logo.webp\";\nimport { Button, Textarea } from \"../../molecules\";\nimport FileDrop, { useFileDrop } from \"../../organisms/FileDrop\";\nimport Modal from \"../../organisms/Modal\";\nimport { useGrantMatchContext } from \"./context\";\n\ntype GrantMatchModalProps = {\n findGrantsCallback?: () => void;\n closeModalCallback?: () => void;\n};\n\nconst GrantMatchModal = ({\n findGrantsCallback,\n closeModalCallback,\n}: GrantMatchModalProps) => {\n const { activeQuery, closeModal } = useGrantMatchContext();\n const { files, uploadFiles, removeFile, errorMessage } = useFileDrop(\n activeQuery.files,\n );\n\n const onClickClose = () => {\n if (closeModalCallback) {\n closeModalCallback();\n }\n\n closeModal();\n };\n\n return (\n <Modal\n header={<ModalHeader />}\n content={\n <ModalContent\n files={files}\n uploadFiles={uploadFiles}\n removeFile={removeFile}\n errorMessage={errorMessage}\n />\n }\n footer={\n <FindGrantsButton\n files={files}\n findGrantsCallback={findGrantsCallback}\n />\n }\n onClickClose={onClickClose}\n width=\"600px\"\n height=\"560px\"\n />\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: 16px;\n`;\n\nconst GrantMatchLogo = styled(Image)`\n width: 24px;\n height: 24px;\n\n box-shadow: 0px 0px 5px 5px #ffe2b680;\n border-radius: 120px;\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={QUERY_TEXTAREA_ID}>Tell us what you intend to do</label>\n <Textarea\n id={QUERY_TEXTAREA_ID}\n value={queryText}\n onChange={(event) => updateQueryText(event.target.value)}\n placeholder=\"Give a summary of your project, specifying the key activities you will do & what you intend to achieve\"\n />\n </ModalQueryText>\n </BaseContent>\n );\n};\n\nconst QUERY_TEXTAREA_ID = \"query-textarea\";\n\nconst BaseContent = styled.div`\n display: flex;\n flex-direction: column;\n gap: 12px;\n`;\n\nconst 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 FindGrantsButtonProps = {\n files: File[];\n findGrantsCallback?: () => void;\n};\n\nconst FindGrantsButton = ({\n files,\n findGrantsCallback,\n}: FindGrantsButtonProps) => {\n const { updateActiveQuery, queryText, closeModal } = useGrantMatchContext();\n const hasQuery = queryText.trim() !== \"\" || files.length > 0;\n\n const onClick = () => {\n if (findGrantsCallback) {\n findGrantsCallback();\n }\n\n updateActiveQuery({ files, text: queryText });\n closeModal();\n };\n\n return (\n <Button\n label=\"Find My Grants\"\n onClick={onClick}\n variant=\"secondary\"\n disabled={!hasQuery}\n />\n );\n};\n"]}
|
package/core/organisms/Modal.js
CHANGED
|
@@ -91,5 +91,5 @@ const ModalFooter = styled.div `
|
|
|
91
91
|
|
|
92
92
|
padding: 16px 20px;
|
|
93
93
|
`;
|
|
94
|
-
const CloseButton = ({ onClick, closeText = "Close" }) => (_jsx(Button, { label: closeText, onClick: onClick,
|
|
94
|
+
const CloseButton = ({ onClick, closeText = "Close" }) => (_jsx(Button, { label: closeText, onClick: onClick, variant: "tertiary" }));
|
|
95
95
|
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../core/organisms/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAIL,WAAW,EACX,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAY/C,MAAM,KAAK,GAAG,CAAC,EACb,MAAM,EACN,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,YAAY,EACZ,SAAS,GACE,EAAE,EAAE,CACf,YAAY,CACV,KAAC,OAAO,sCACN,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QACT,SAAS;QACT,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAuC;;;;sBAI/C,KAAK,CAAC,OAAO,CAAC,KAAK;;;;;oBAKrB,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;;;;;;;;qBAWlC,UAAU,CAAC,iBAAiB,CAAC,MAAM;;;;;aAK3C,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM;cACrB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO;;;;CAIrC,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;6BAOD,KAAK,CAAC,OAAO,CAAC,KAAK;CAC/C,CAAC;AAEF,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;CAe3B,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAM7B,CAAC;AAOF,MAAM,WAAW,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,EAAoB,EAAE,EAAE,CAAC,CAC1E,KAAC,MAAM,IAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAC,UAAU,GAAG,CAClE,CAAC","sourcesContent":["import {\n type JSX,\n type MouseEventHandler,\n type ReactNode,\n useCallback,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport styled from \"styled-components\";\nimport { Color, Responsive } from \"../atoms\";\nimport { Button, Overlay } from \"../molecules\";\n\ntype ModalProps = {\n header?: ReactNode;\n content: JSX.Element;\n footer?: ReactNode;\n width?: string;\n height?: string;\n onClickClose?: MouseEventHandler<HTMLButtonElement>;\n closeText?: string;\n};\n\nconst Modal = ({\n header,\n content,\n footer,\n width,\n height,\n onClickClose,\n closeText,\n}: ModalProps) =>\n createPortal(\n <Overlay $centerContent>\n <ModalWindow $width={width} $height={height}>\n {header ? <ModalHeader>{header}</ModalHeader> : <></>}\n\n <ModalBody>{content}</ModalBody>\n\n {onClickClose || footer ? (\n <ModalFooter>\n {onClickClose ? (\n <CloseButton onClick={onClickClose} closeText={closeText} />\n ) : (\n <></>\n )}\n\n {footer ? footer : <></>}\n </ModalFooter>\n ) : (\n <></>\n )}\n </ModalWindow>\n </Overlay>,\n document.body,\n );\n\nexport default Modal;\n\nexport const useModal = () => {\n const [showModal, setShowModal] = useState(false);\n\n const lockScroll = useCallback(() => {\n document.body.style.overflow = \"hidden\";\n }, []);\n\n const unlockScroll = useCallback(() => {\n document.body.style.overflow = \"initial\";\n }, []);\n\n const openModal = () => {\n setShowModal(true);\n lockScroll();\n };\n\n const closeModal = () => {\n setShowModal(false);\n unlockScroll();\n };\n\n return {\n showModal,\n openModal,\n closeModal,\n };\n};\n\nconst 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: 100px;\n max-height: 100vh;\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n position: fixed;\n bottom: 0px;\n left: 0px;\n\n width: 100%;\n height: 100%;\n\n border-radius: 0px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n position: static;\n bottom: auto;\n left: auto;\n\n width: ${({ $width }) => $width};\n height: ${({ $height }) => $height};\n\n border-radius: 8px;\n }\n`;\n\nconst ModalHeader = styled.div`\n font-weight: 500;\n font-size: 18px;\n\n padding: 12px 20px;\n margin-bottom: 12px;\n\n border-bottom: 1px solid ${Color.neutral.grey3};\n`;\n\nconst ModalBody = styled.div`\n display: flex;\n flex-direction: column;\n\n height: 100%;\n overflow-y: auto;\n\n > * {\n width: 100%;\n height: 100%;\n min-height: 100px;\n\n padding: 2px 20px;\n border: none;\n }\n`;\n\nconst ModalFooter = styled.div`\n display: flex;\n justify-content: space-between;\n gap: 12px;\n\n padding: 16px 20px;\n`;\n\ntype CloseButtonProps = {\n onClick: MouseEventHandler<HTMLButtonElement>;\n closeText?: string;\n};\n\nconst CloseButton = ({ onClick, closeText = \"Close\" }: CloseButtonProps) => (\n <Button label={closeText} onClick={onClick} variant=\"tertiary\" />\n);\n"]}
|
package/core/shared.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
import { SystemIcon } from "./atoms";
|
|
2
|
-
export declare const BaseButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$backgroundColor" | "$color" | "$underline" | "$borderColor" | "$width"> & {
|
|
3
|
-
$underline?: boolean;
|
|
4
|
-
$backgroundColor?: string;
|
|
5
|
-
$borderColor?: string;
|
|
6
|
-
$color?: string;
|
|
7
|
-
$width?: string;
|
|
8
|
-
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$backgroundColor" | "$color" | "$underline" | "$borderColor" | "$width"> & {
|
|
9
|
-
$underline?: boolean;
|
|
10
|
-
$backgroundColor?: string;
|
|
11
|
-
$borderColor?: string;
|
|
12
|
-
$color?: string;
|
|
13
|
-
$width?: string;
|
|
14
|
-
}, never>>> & string;
|
|
15
2
|
export declare const LabelledInput: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
16
3
|
export type InputValidationProps = {
|
|
17
4
|
$hasError?: boolean;
|
package/core/shared.js
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { Color, SystemIcon } from "./atoms";
|
|
3
|
-
// TODO: refactor away
|
|
4
|
-
export const BaseButton = styled.div `
|
|
5
|
-
display: flex;
|
|
6
|
-
justify-content: center;
|
|
7
|
-
align-items: center;
|
|
8
|
-
gap: 10px;
|
|
9
|
-
|
|
10
|
-
width: ${({ $width = "auto" }) => $width};
|
|
11
|
-
|
|
12
|
-
padding: 10px 16px;
|
|
13
|
-
|
|
14
|
-
font-weight: 500;
|
|
15
|
-
font-size: 14px;
|
|
16
|
-
|
|
17
|
-
white-space: nowrap;
|
|
18
|
-
text-decoration: ${({ $underline = false }) => $underline ? "underline" : "none"};
|
|
19
|
-
|
|
20
|
-
color: ${({ $color = Color.typography.whiteHigh }) => $color};
|
|
21
|
-
background-color: ${({ $underline = false, $backgroundColor = Color.brand.grantbiiBlue, }) => ($underline ? "transparent" : $backgroundColor)};
|
|
22
|
-
|
|
23
|
-
border: 1px solid ${({ $borderColor = "transparent" }) => $borderColor};
|
|
24
|
-
border-radius: 8px;
|
|
25
|
-
`;
|
|
26
3
|
export const LabelledInput = styled.div `
|
|
27
4
|
display: flex;
|
|
28
5
|
align-items: center;
|
package/core/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../core/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5C,
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../core/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAItC,CAAC;AAMF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAsB;;wBAEhC,KAAK,CAAC,OAAO,CAAC,KAAK;wBACnB,KAAK,CAAC,OAAO,CAAC,KAAK;;;;;wBAKnB,KAAK,CAAC,OAAO,CAAC,KAAK;wBACnB,KAAK,CAAC,OAAO,CAAC,KAAK;;;;;wBAKnB,KAAK,CAAC,OAAO,CAAC,KAAK;wBACnB,KAAK,CAAC,MAAM,CAAC,KAAK;yBACjB,KAAK,CAAC,MAAM,CAAC,KAAK;;;;wBAInB,KAAK,CAAC,OAAO,CAAC,KAAK;wBACnB,KAAK,CAAC,MAAM,CAAC,IAAI;;;;;wBAKjB,KAAK,CAAC,OAAO,CAAC,KAAK;wBACnB,KAAK,CAAC,MAAM,CAAC,IAAI;yBAChB,KAAK,CAAC,MAAM,CAAC,IAAI;;;IAGtC,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,EAAE,EAAE,CAC1B,SAAS;IACP,CAAC,CAAC,GAAG,CAAA;;gCAEqB,KAAK,CAAC,OAAO,CAAC,KAAK;gCACnB,KAAK,CAAC,MAAM,CAAC,IAAI;;;;;gCAKjB,KAAK,CAAC,OAAO,CAAC,KAAK;gCACnB,KAAK,CAAC,MAAM,CAAC,IAAI;iCAChB,KAAK,CAAC,MAAM,CAAC,IAAI;;SAEzC;IACH,CAAC,CAAC,GAAG,CAAA,EAAE;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA4C;IACzE,iBAAiB,EAAE,UAAU,CAAC,WAAW;IACzC,WAAW,EAAE,UAAU,CAAC,WAAW;IACnC,YAAY,EAAE,UAAU,CAAC,WAAW;CACrC,CAAC","sourcesContent":["import styled, { css } from \"styled-components\";\nimport { Color, SystemIcon } from \"./atoms\";\n\nexport const LabelledInput = styled.div`\n display: flex;\n align-items: center;\n gap: 8px;\n`;\n\nexport type InputValidationProps = {\n $hasError?: boolean;\n};\n\nexport const InputValidation = css<InputValidationProps>`\n &:disabled {\n background-color: ${Color.neutral.grey4};\n border: 1px solid ${Color.neutral.grey3};\n outline: none;\n }\n\n &:valid {\n background-color: ${Color.neutral.white};\n border: 1px solid ${Color.neutral.grey3};\n outline: none;\n }\n\n &:valid&:focus {\n background-color: ${Color.neutral.white};\n border: 1px solid ${Color.accent.blue1};\n outline: 1px solid ${Color.accent.blue1};\n }\n\n &:invalid {\n background-color: ${Color.neutral.white};\n border: 1px solid ${Color.accent.red1};\n outline: none;\n }\n\n &:invalid&:focus {\n background-color: ${Color.neutral.white};\n border: 1px solid ${Color.accent.red1};\n outline: 1px solid ${Color.accent.red1};\n }\n\n ${({ $hasError = false }) =>\n $hasError\n ? css`\n &:valid {\n background-color: ${Color.neutral.white};\n border: 1px solid ${Color.accent.red1};\n outline: none;\n }\n\n &:valid&:focus {\n background-color: ${Color.neutral.white};\n border: 1px solid ${Color.accent.red1};\n outline: 1px solid ${Color.accent.red1};\n }\n `\n : css``}\n`;\n\nexport const FILE_TYPE_ICON_MAP: { [mimeType: string]: SystemIcon.Icon } = {\n \"application/pdf\": SystemIcon.FilePdfIcon,\n \"image/png\": SystemIcon.FilePngIcon,\n \"image/jpeg\": SystemIcon.FileJpgIcon,\n};\n"]}
|
|
@@ -5,7 +5,7 @@ import errorLogo from "../assets/logos/error_logo.webp";
|
|
|
5
5
|
import { Color, Responsive, Typography } from "../atoms";
|
|
6
6
|
import { applyTypography } from "../integrations";
|
|
7
7
|
import { Button } from "../molecules";
|
|
8
|
-
const ErrorFallback = ({ errorMessage = DEFAULT_ERROR_MESSAGE, errorDescription, onClickReload, }) => (_jsxs(BaseErrorFallback, { children: [_jsx(ErrorLogo, { src: errorLogo, width: 693, height: 641, alt: errorMessage }), _jsx(ErrorText, { errorMessage: errorMessage, errorDescription: errorDescription }), onClickReload ? (_jsx(Button, { label: "Try Again", onClick: onClickReload,
|
|
8
|
+
const ErrorFallback = ({ errorMessage = DEFAULT_ERROR_MESSAGE, errorDescription, onClickReload, }) => (_jsxs(BaseErrorFallback, { children: [_jsx(ErrorLogo, { src: errorLogo, width: 693, height: 641, alt: errorMessage }), _jsx(ErrorText, { errorMessage: errorMessage, errorDescription: errorDescription }), onClickReload ? (_jsx(Button, { label: "Try Again", onClick: onClickReload, variant: "outline" })) : (_jsx(_Fragment, {}))] }));
|
|
9
9
|
export default ErrorFallback;
|
|
10
10
|
const DEFAULT_ERROR_MESSAGE = "Something went wrong";
|
|
11
11
|
const BaseErrorFallback = styled.div `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorFallback.js","sourceRoot":"","sources":["../../../core/templates/ErrorFallback.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAQtC,MAAM,aAAa,GAAG,CAAC,EACrB,YAAY,GAAG,qBAAqB,EACpC,gBAAgB,EAChB,aAAa,GACM,EAAE,EAAE,CAAC,CACxB,MAAC,iBAAiB,eAChB,KAAC,SAAS,IAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,YAAY,GAAI,EAEzE,KAAC,SAAS,IACR,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,gBAAgB,GAClC,EAED,aAAa,CAAC,CAAC,CAAC,CACf,KAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"ErrorFallback.js","sourceRoot":"","sources":["../../../core/templates/ErrorFallback.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,SAAS,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE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1C,gBAAgB,CAAC,CAAC,CAAC,CAClB,KAAC,gBAAgB,cAAE,gBAAgB,GAAoB,CACxD,CAAC,CAAC,CAAC,CACF,mBAAK,CACN,IACa,CACjB,CAAC;AAEF,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;CAO/B,CAAC;AAEF,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAA;IACzB,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC;CACvC,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;IAC/B,eAAe,CAAC,UAAU,CAAC,kBAAkB,CAAC;CACjD,CAAC","sourcesContent":["import Image from \"next/image\";\nimport type { MouseEventHandler, ReactNode } from \"react\";\nimport styled from \"styled-components\";\nimport errorLogo from \"../assets/logos/error_logo.webp\";\nimport { Color, Responsive, Typography } from \"../atoms\";\nimport { applyTypography } from \"../integrations\";\nimport { Button } from \"../molecules\";\n\ntype ErrorFallbackProps = {\n errorMessage?: string;\n errorDescription?: ReactNode;\n onClickReload?: MouseEventHandler<HTMLButtonElement>;\n};\n\nconst ErrorFallback = ({\n errorMessage = DEFAULT_ERROR_MESSAGE,\n errorDescription,\n onClickReload,\n}: ErrorFallbackProps) => (\n <BaseErrorFallback>\n <ErrorLogo src={errorLogo} width={693} height={641} alt={errorMessage} />\n\n <ErrorText\n errorMessage={errorMessage}\n errorDescription={errorDescription}\n />\n\n {onClickReload ? (\n <Button label=\"Try Again\" onClick={onClickReload} variant=\"outline\" />\n ) : (\n <></>\n )}\n </BaseErrorFallback>\n);\n\nexport default ErrorFallback;\n\nconst DEFAULT_ERROR_MESSAGE = \"Something went wrong\";\n\nconst BaseErrorFallback = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n width: 100%;\n height: 100%;\n padding: 24px;\n\n background-color: ${Color.neutral.white};\n\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 16px;\n\n border: none;\n border-radius: 0px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n gap: 24px;\n\n border: 1px solid ${Color.neutral.grey3};\n border-radius: 12px;\n }\n`;\n\nconst ErrorLogo = styled(Image)`\n @media (width < ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n width: 151px;\n height: 140px;\n }\n\n @media (width >= ${Responsive.WIDTH_BREAKPOINTS.laptop}) {\n width: 173px;\n height: 160px;\n }\n`;\n\ntype LoadingFailedTextProps = {\n errorMessage: string;\n errorDescription?: ReactNode;\n};\n\nconst ErrorText = ({\n errorMessage,\n errorDescription,\n}: LoadingFailedTextProps) => (\n <BaseErrorText>\n <ErrorMessage>{errorMessage}</ErrorMessage>\n\n {errorDescription ? (\n <ErrorDescription>{errorDescription}</ErrorDescription>\n ) : (\n <></>\n )}\n </BaseErrorText>\n);\n\nconst BaseErrorText = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n\n text-align: center;\n`;\n\nconst ErrorMessage = styled.p`\n ${applyTypography(Typography.heading3)}\n`;\n\nconst ErrorDescription = styled.div`\n ${applyTypography(Typography.bodyPrimaryRegular)}\n`;\n"]}
|
package/package.json
CHANGED