@thecb/components 4.4.2 → 4.5.0-beta.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/dist/index.cjs.js +22 -40
- package/package.json +1 -1
- package/src/components/atoms/detail/Detail.js +76 -0
- package/src/components/atoms/detail/Detail.styled.js +13 -0
- package/src/components/atoms/detail/Detail.theme.js +32 -0
- package/src/components/atoms/detail/index.js +3 -0
- package/src/components/atoms/heading/Heading.js +6 -0
- package/src/components/atoms/labeled-amount/LabeledAmount.js +3 -10
- package/src/components/atoms/labeled-amount/LabeledAmount.theme.js +0 -1
- package/src/components/atoms/line-item/LineItem.theme.js +1 -1
- package/src/components/atoms/paragraph/Paragraph.js +6 -0
- package/src/components/atoms/title/Title.js +75 -0
- package/src/components/atoms/title/Title.styled.js +13 -0
- package/src/components/atoms/title/Title.theme.js +26 -0
- package/src/components/atoms/title/index.js +3 -0
- package/src/components/molecules/module/Module.js +1 -3
- package/src/components/molecules/module/Module.theme.js +9 -27
- package/src/components/molecules/payment-details/PaymentDetails.js +2 -6
- package/src/components/molecules/payment-details/PaymentDetails.theme.js +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -16403,7 +16403,7 @@ function parseToRgb(color) {
|
|
|
16403
16403
|
};
|
|
16404
16404
|
}
|
|
16405
16405
|
|
|
16406
|
-
var rgbaMatched = rgbaRegex.exec(normalizedColor);
|
|
16406
|
+
var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
|
|
16407
16407
|
|
|
16408
16408
|
if (rgbaMatched) {
|
|
16409
16409
|
return {
|
|
@@ -16434,7 +16434,7 @@ function parseToRgb(color) {
|
|
|
16434
16434
|
};
|
|
16435
16435
|
}
|
|
16436
16436
|
|
|
16437
|
-
var hslaMatched = hslaRegex.exec(normalizedColor);
|
|
16437
|
+
var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
|
|
16438
16438
|
|
|
16439
16439
|
if (hslaMatched) {
|
|
16440
16440
|
var _hue = parseInt("" + hslaMatched[1], 10);
|
|
@@ -21633,7 +21633,6 @@ var Jumbo$1 = withWindowSize(Jumbo);
|
|
|
21633
21633
|
|
|
21634
21634
|
var fontWeight$4 = {
|
|
21635
21635
|
"default": "600",
|
|
21636
|
-
pS: "600",
|
|
21637
21636
|
p: "600",
|
|
21638
21637
|
pL: "600",
|
|
21639
21638
|
h6: "700"
|
|
@@ -21648,8 +21647,7 @@ var LabeledAmount = function LabeledAmount(_ref) {
|
|
|
21648
21647
|
label = _ref.label,
|
|
21649
21648
|
amount = _ref.amount,
|
|
21650
21649
|
themeValues = _ref.themeValues,
|
|
21651
|
-
as = _ref.as
|
|
21652
|
-
extraStyles = _ref.extraStyles;
|
|
21650
|
+
as = _ref.as;
|
|
21653
21651
|
var LabeledAmountText = variant === "h6" ? Heading$1 : Paragraph$1;
|
|
21654
21652
|
return /*#__PURE__*/React__default.createElement(Stack, {
|
|
21655
21653
|
direction: "row"
|
|
@@ -21657,12 +21655,12 @@ var LabeledAmount = function LabeledAmount(_ref) {
|
|
|
21657
21655
|
variant: variant,
|
|
21658
21656
|
as: as,
|
|
21659
21657
|
weight: themeValues.fontWeight,
|
|
21660
|
-
extraStyles: "
|
|
21658
|
+
extraStyles: "text-align: start; flex: 3;"
|
|
21661
21659
|
}, label, ":"), /*#__PURE__*/React__default.createElement(LabeledAmountText, {
|
|
21662
21660
|
variant: variant,
|
|
21663
21661
|
as: as,
|
|
21664
21662
|
weight: themeValues.fontWeight,
|
|
21665
|
-
extraStyles: "
|
|
21663
|
+
extraStyles: "text-align: end; flex: 1;"
|
|
21666
21664
|
}, amount));
|
|
21667
21665
|
};
|
|
21668
21666
|
|
|
@@ -21674,7 +21672,7 @@ var weightTitle = {
|
|
|
21674
21672
|
};
|
|
21675
21673
|
var paragraphVariant = {
|
|
21676
21674
|
"default": "pL",
|
|
21677
|
-
small: "
|
|
21675
|
+
small: "p"
|
|
21678
21676
|
};
|
|
21679
21677
|
var fallbackValues$l = {
|
|
21680
21678
|
weightTitle: weightTitle,
|
|
@@ -39014,53 +39012,43 @@ var Modal$1 = function Modal(_ref) {
|
|
|
39014
39012
|
|
|
39015
39013
|
var fontSize$8 = {
|
|
39016
39014
|
"default": "1.375rem",
|
|
39017
|
-
largeTitle: "1.75rem"
|
|
39018
|
-
small: "1.25rem"
|
|
39015
|
+
largeTitle: "1.75rem"
|
|
39019
39016
|
};
|
|
39020
39017
|
var fontWeight$5 = {
|
|
39021
39018
|
"default": "600",
|
|
39022
|
-
largeTitle: "700"
|
|
39023
|
-
small: "600"
|
|
39019
|
+
largeTitle: "700"
|
|
39024
39020
|
};
|
|
39025
39021
|
var fontColor = {
|
|
39026
39022
|
"default": CHARADE_GREY,
|
|
39027
|
-
largeTitle: CHARADE_GREY
|
|
39028
|
-
small: CHARADE_GREY
|
|
39023
|
+
largeTitle: CHARADE_GREY
|
|
39029
39024
|
};
|
|
39030
39025
|
var lineHeight$4 = {
|
|
39031
39026
|
"default": "2rem",
|
|
39032
|
-
largeTitle: "2rem"
|
|
39033
|
-
small: "2rem"
|
|
39027
|
+
largeTitle: "2rem"
|
|
39034
39028
|
};
|
|
39035
39029
|
var textAlign = {
|
|
39036
39030
|
"default": "left",
|
|
39037
|
-
largeTitle: "left"
|
|
39038
|
-
small: "left"
|
|
39031
|
+
largeTitle: "left"
|
|
39039
39032
|
};
|
|
39040
39033
|
var titleType = {
|
|
39041
39034
|
"default": "h5",
|
|
39042
|
-
largeTitle: "h1"
|
|
39043
|
-
small: "h6"
|
|
39035
|
+
largeTitle: "h1"
|
|
39044
39036
|
};
|
|
39045
39037
|
var titleSpacing = {
|
|
39046
39038
|
"default": "0.5rem",
|
|
39047
|
-
largeTitle: "1.125rem"
|
|
39048
|
-
small: "0.5rem"
|
|
39039
|
+
largeTitle: "1.125rem"
|
|
39049
39040
|
};
|
|
39050
39041
|
var boxShadow$1 = {
|
|
39051
39042
|
"default": "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
39052
|
-
largeTitle: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
|
|
39053
|
-
small: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
|
|
39043
|
+
largeTitle: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
|
|
39054
39044
|
};
|
|
39055
39045
|
var borderRadius = {
|
|
39056
39046
|
"default": "0.25rem",
|
|
39057
|
-
largeTitle: "0.25rem"
|
|
39058
|
-
small: "0.25rem"
|
|
39047
|
+
largeTitle: "0.25rem"
|
|
39059
39048
|
};
|
|
39060
39049
|
var backgroundColor$6 = {
|
|
39061
39050
|
"default": WHITE,
|
|
39062
|
-
largeTitle: WHITE
|
|
39063
|
-
small: WHITE
|
|
39051
|
+
largeTitle: WHITE
|
|
39064
39052
|
};
|
|
39065
39053
|
var fallbackValues$v = {
|
|
39066
39054
|
fontSize: fontSize$8,
|
|
@@ -39088,7 +39076,7 @@ var Module = function Module(_ref) {
|
|
|
39088
39076
|
variant = _ref$variant === void 0 ? "default" : _ref$variant,
|
|
39089
39077
|
children = _ref.children;
|
|
39090
39078
|
return /*#__PURE__*/React__default.createElement(React.Fragment, null, heading && /*#__PURE__*/React__default.createElement(Heading$1, {
|
|
39091
|
-
variant: variant === "
|
|
39079
|
+
variant: variant === "default" ? "h5" : "h2",
|
|
39092
39080
|
weight: themeValues.fontWeight,
|
|
39093
39081
|
color: themeValues.fontColor,
|
|
39094
39082
|
margin: "".concat(spacing, " 0 ").concat(themeValues.titleSpacing, " 0"),
|
|
@@ -39915,11 +39903,11 @@ var lineItem = {
|
|
|
39915
39903
|
};
|
|
39916
39904
|
var labeledAmountSubtotal = {
|
|
39917
39905
|
"default": "pL",
|
|
39918
|
-
small: "
|
|
39906
|
+
small: "p"
|
|
39919
39907
|
};
|
|
39920
39908
|
var labeledAmountTotal = {
|
|
39921
39909
|
"default": "h6",
|
|
39922
|
-
small: "
|
|
39910
|
+
small: "pL"
|
|
39923
39911
|
};
|
|
39924
39912
|
var fallbackValues$y = {
|
|
39925
39913
|
backgroundColor: backgroundColor$8,
|
|
@@ -39933,7 +39921,6 @@ var PaymentDetailsContent = function PaymentDetailsContent(_ref) {
|
|
|
39933
39921
|
feeElems = _ref.feeElems,
|
|
39934
39922
|
subtotal = _ref.subtotal,
|
|
39935
39923
|
total = _ref.total,
|
|
39936
|
-
variant = _ref.variant,
|
|
39937
39924
|
themeValues = _ref.themeValues;
|
|
39938
39925
|
return /*#__PURE__*/React__default.createElement(Stack, {
|
|
39939
39926
|
childGap: "16px"
|
|
@@ -39947,8 +39934,7 @@ var PaymentDetailsContent = function PaymentDetailsContent(_ref) {
|
|
|
39947
39934
|
as: "h2",
|
|
39948
39935
|
variant: themeValues.labeledAmountTotal,
|
|
39949
39936
|
label: "Total",
|
|
39950
|
-
amount: displayCurrency(total)
|
|
39951
|
-
extraStyles: variant === "small" && "font-weight: ".concat(FONT_WEIGHT_BOLD, ";")
|
|
39937
|
+
amount: displayCurrency(total)
|
|
39952
39938
|
}));
|
|
39953
39939
|
};
|
|
39954
39940
|
|
|
@@ -39993,8 +39979,6 @@ var PaymentDetails = function PaymentDetails(_ref4) {
|
|
|
39993
39979
|
_fees = _ref4.fees,
|
|
39994
39980
|
subtotal = _ref4.subtotal,
|
|
39995
39981
|
total = _ref4.total,
|
|
39996
|
-
_ref4$variant = _ref4.variant,
|
|
39997
|
-
variant = _ref4$variant === void 0 ? "default" : _ref4$variant,
|
|
39998
39982
|
_ref4$hideTitle = _ref4.hideTitle,
|
|
39999
39983
|
hideTitle = _ref4$hideTitle === void 0 ? false : _ref4$hideTitle,
|
|
40000
39984
|
_ref4$titleText = _ref4.titleText,
|
|
@@ -40060,15 +40044,13 @@ var PaymentDetails = function PaymentDetails(_ref4) {
|
|
|
40060
40044
|
feeElems: feeElems,
|
|
40061
40045
|
subtotal: subtotal,
|
|
40062
40046
|
total: total,
|
|
40063
|
-
themeValues: themeValues
|
|
40064
|
-
variant: variant
|
|
40047
|
+
themeValues: themeValues
|
|
40065
40048
|
})) : /*#__PURE__*/React__default.createElement(PaymentDetailsContent, {
|
|
40066
40049
|
lineItemElems: lineItemElems,
|
|
40067
40050
|
feeElems: feeElems,
|
|
40068
40051
|
subtotal: subtotal,
|
|
40069
40052
|
total: total,
|
|
40070
|
-
themeValues: themeValues
|
|
40071
|
-
variant: variant
|
|
40053
|
+
themeValues: themeValues
|
|
40072
40054
|
});
|
|
40073
40055
|
var title = hideTitle ? /*#__PURE__*/React__default.createElement(React.Fragment, null) : isCollapsible ? /*#__PURE__*/React__default.createElement(Box, {
|
|
40074
40056
|
width: "100%",
|
package/package.json
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
3
|
+
import { FIREFLY_GREY } from "../../../constants/colors";
|
|
4
|
+
import { DetailText } from "./Detail.styled";
|
|
5
|
+
import { safeChildren } from "../../../util/general";
|
|
6
|
+
import {
|
|
7
|
+
fallbackValues,
|
|
8
|
+
mobileFallbackValues,
|
|
9
|
+
MOBILE_BREAKPOINT
|
|
10
|
+
} from "./Detail.theme";
|
|
11
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
New responsive text component for Detail elements
|
|
15
|
+
(Block level text elements which are smaller than "Title" elements)
|
|
16
|
+
Size is decoupled from tag
|
|
17
|
+
Comes with two variants - "large" and "small"
|
|
18
|
+
Large variant results in text that is 1.5rem (24px desktop, 21px mobile)
|
|
19
|
+
Small variant results in text that is 1.25rem/1.2142rem (20px desktop, 17px mobile)
|
|
20
|
+
|
|
21
|
+
If you need a smaller larger size, use the <Title /> atom, which has larger variants
|
|
22
|
+
|
|
23
|
+
Use the "as" prop to specify element type, can use any of: h1/h2/h3/h4/h5/h6/p
|
|
24
|
+
If you need an inline text element (span), use the <Text /> atom
|
|
25
|
+
The "as" value should be dictated by the structure of your page, not what font-size you want
|
|
26
|
+
|
|
27
|
+
Title / Detail both use slightly different desktop/mobile scales
|
|
28
|
+
(Mobile scale is different to allow for design-friendly px values)
|
|
29
|
+
Both atoms detect the presence of a mobile device on their own
|
|
30
|
+
and apply the corresponding scale
|
|
31
|
+
|
|
32
|
+
Mobile breakpoint value is specified in Detail.theme.js
|
|
33
|
+
|
|
34
|
+
If you want to disable mobile text scales (use the same rem scale for desktop/mobile), then use a theme in FCS to set all of the variants to use the same rem sizes. FCS themes override fallbacks defined in the .theme file
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
const isBelowBreakpoint = window.innerWidth < MOBILE_BREAKPOINT;
|
|
38
|
+
const isTouchDevice = "ontouchstart" in window || navigator.maxTouchPoints > 1;
|
|
39
|
+
const mobileDeviceDetected = isBelowBreakpoint && isTouchDevice;
|
|
40
|
+
const fallbacks = mobileDeviceDetected ? mobileFallbackValues : fallbackValues;
|
|
41
|
+
|
|
42
|
+
const Detail = ({
|
|
43
|
+
themeValues,
|
|
44
|
+
weight = FONT_WEIGHT_REGULAR,
|
|
45
|
+
color = FIREFLY_GREY,
|
|
46
|
+
margin = 0,
|
|
47
|
+
textAlign,
|
|
48
|
+
extraStyles = ``,
|
|
49
|
+
className,
|
|
50
|
+
variant = "regular",
|
|
51
|
+
as = "p",
|
|
52
|
+
dataQa,
|
|
53
|
+
children,
|
|
54
|
+
...rest
|
|
55
|
+
}) => {
|
|
56
|
+
return (
|
|
57
|
+
<DetailText
|
|
58
|
+
variant={variant}
|
|
59
|
+
as={as}
|
|
60
|
+
weight={weight}
|
|
61
|
+
color={color}
|
|
62
|
+
margin={margin}
|
|
63
|
+
textAlign={textAlign}
|
|
64
|
+
extraStyles={extraStyles}
|
|
65
|
+
className={className}
|
|
66
|
+
fontFamily={themeValues.fontFamily}
|
|
67
|
+
fontSize={themeValues.fontSize}
|
|
68
|
+
data-qa={dataQa}
|
|
69
|
+
{...rest}
|
|
70
|
+
>
|
|
71
|
+
{safeChildren(children, <span />)}
|
|
72
|
+
</DetailText>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default themeComponent(Detail, "Detail", fallbacks, "regular");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const DetailText = styled.p`
|
|
4
|
+
font-size: ${({ fontSize }) => fontSize};
|
|
5
|
+
line-height: 1.5;
|
|
6
|
+
color: ${({ color }) => color};
|
|
7
|
+
font-weight: ${({ weight }) => weight};
|
|
8
|
+
margin: ${({ margin }) => margin};
|
|
9
|
+
text-align: ${({ textAlign }) => textAlign};
|
|
10
|
+
font-family: ${({ fontFamily }) => fontFamily};
|
|
11
|
+
|
|
12
|
+
${({ extraStyles }) => extraStyles};
|
|
13
|
+
`;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const fontSize = {
|
|
2
|
+
large: "1.125rem",
|
|
3
|
+
regular: "1rem",
|
|
4
|
+
small: "0.875rem",
|
|
5
|
+
extraSmall: "0.75rem"
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const fontFamily = {
|
|
9
|
+
large: "Public Sans",
|
|
10
|
+
regular: "Public Sans",
|
|
11
|
+
small: "Public Sans",
|
|
12
|
+
extraSmall: "Public Sans"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const mobileFontSize = {
|
|
16
|
+
large: "1.14285rem",
|
|
17
|
+
regular: "1",
|
|
18
|
+
small: "0.85714rem",
|
|
19
|
+
extraSmall: "0.71428rem"
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const fallbackValues = {
|
|
23
|
+
fontFamily,
|
|
24
|
+
fontSize
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const mobileFallbackValues = {
|
|
28
|
+
fontFamily,
|
|
29
|
+
fontSize: mobileFontSize
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const MOBILE_BREAKPOINT = 768;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
SOON TO BE DEPRECATED AS OF 8/1/2021
|
|
3
|
+
|
|
4
|
+
For new pages/applications, please us <Title /> and <Detail /> atoms
|
|
5
|
+
|
|
6
|
+
*/
|
|
1
7
|
import React from "react";
|
|
2
8
|
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
3
9
|
import { FIREFLY_GREY } from "../../../constants/colors";
|
|
@@ -5,14 +5,7 @@ import { Stack } from "../layouts";
|
|
|
5
5
|
import Heading from "../heading";
|
|
6
6
|
import Paragraph from "../paragraph";
|
|
7
7
|
|
|
8
|
-
const LabeledAmount = ({
|
|
9
|
-
variant = "pL",
|
|
10
|
-
label,
|
|
11
|
-
amount,
|
|
12
|
-
themeValues,
|
|
13
|
-
as,
|
|
14
|
-
extraStyles
|
|
15
|
-
}) => {
|
|
8
|
+
const LabeledAmount = ({ variant = "pL", label, amount, themeValues, as }) => {
|
|
16
9
|
const LabeledAmountText = variant === "h6" ? Heading : Paragraph;
|
|
17
10
|
return (
|
|
18
11
|
<Stack direction="row">
|
|
@@ -20,7 +13,7 @@ const LabeledAmount = ({
|
|
|
20
13
|
variant={variant}
|
|
21
14
|
as={as}
|
|
22
15
|
weight={themeValues.fontWeight}
|
|
23
|
-
extraStyles=
|
|
16
|
+
extraStyles="text-align: start; flex: 3;"
|
|
24
17
|
>
|
|
25
18
|
{label}:
|
|
26
19
|
</LabeledAmountText>
|
|
@@ -28,7 +21,7 @@ const LabeledAmount = ({
|
|
|
28
21
|
variant={variant}
|
|
29
22
|
as={as}
|
|
30
23
|
weight={themeValues.fontWeight}
|
|
31
|
-
extraStyles=
|
|
24
|
+
extraStyles="text-align: end; flex: 1;"
|
|
32
25
|
>
|
|
33
26
|
{amount}
|
|
34
27
|
</LabeledAmountText>
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
SOON TO BE DEPRECATED AS OF 8/1/2021
|
|
3
|
+
|
|
4
|
+
For new pages/applications, please us <Title /> and <Detail /> atoms
|
|
5
|
+
|
|
6
|
+
*/
|
|
1
7
|
import React from "react";
|
|
2
8
|
import { fallbackValues } from "./Paragraph.theme";
|
|
3
9
|
import { themeComponent } from "../../../util/themeUtils";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
3
|
+
import { FIREFLY_GREY } from "../../../constants/colors";
|
|
4
|
+
import { TitleText } from "./Title.styled";
|
|
5
|
+
import { safeChildren } from "../../../util/general";
|
|
6
|
+
import {
|
|
7
|
+
fallbackValues,
|
|
8
|
+
mobileFallbackValues,
|
|
9
|
+
MOBILE_BREAKPOINT
|
|
10
|
+
} from "./Title.theme";
|
|
11
|
+
import { themeComponent } from "../../../util/themeUtils";
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
New responsive text component for Title elements
|
|
15
|
+
Size is decoupled from tag
|
|
16
|
+
Comes with two variants - "large" and "small"
|
|
17
|
+
Large variant results in text that is 1.5rem (24px desktop, 21px mobile)
|
|
18
|
+
Small variant results in text that is 1.25rem/1.2142rem (20px desktop, 17px mobile)
|
|
19
|
+
|
|
20
|
+
If you need a smaller text size, use the <Detail /> atom, which has smaller variants
|
|
21
|
+
|
|
22
|
+
Use the "as" prop to specify element type, can use any of: h1/h2/h3/h4/h5/h6/p
|
|
23
|
+
If you need an inline text element (span), use the <Text /> atom
|
|
24
|
+
The "as" value should be dictated by the structure of your page, not what font-size you want
|
|
25
|
+
|
|
26
|
+
Title / Detail both use slightly different desktop/mobile scales
|
|
27
|
+
(Mobile scale is different to allow for design-friendly px values)
|
|
28
|
+
Both atoms detect the presence of a mobile device on their own
|
|
29
|
+
and apply the corresponding scale
|
|
30
|
+
|
|
31
|
+
Mobile breakpoint value is specified in Title.theme.js
|
|
32
|
+
|
|
33
|
+
If you want to disable mobile text scales (use the same rem scale for desktop/mobile), then use a theme in FCS to set both the "large" and "small" variants to use the same rem sizes. FCS themes override fallbacks defined in the .theme file
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
const isBelowBreakpoint = window.innerWidth < MOBILE_BREAKPOINT;
|
|
37
|
+
const isTouchDevice = "ontouchstart" in window || navigator.maxTouchPoints > 1;
|
|
38
|
+
const mobileDeviceDetected = isBelowBreakpoint && isTouchDevice;
|
|
39
|
+
const fallbacks = mobileDeviceDetected ? mobileFallbackValues : fallbackValues;
|
|
40
|
+
|
|
41
|
+
const Title = ({
|
|
42
|
+
themeValues,
|
|
43
|
+
weight = FONT_WEIGHT_REGULAR,
|
|
44
|
+
color = FIREFLY_GREY,
|
|
45
|
+
margin = 0,
|
|
46
|
+
textAlign,
|
|
47
|
+
extraStyles = ``,
|
|
48
|
+
className,
|
|
49
|
+
variant = "large",
|
|
50
|
+
as = "h1",
|
|
51
|
+
dataQa,
|
|
52
|
+
children,
|
|
53
|
+
...rest
|
|
54
|
+
}) => {
|
|
55
|
+
return (
|
|
56
|
+
<TitleText
|
|
57
|
+
variant={variant}
|
|
58
|
+
as={as}
|
|
59
|
+
weight={weight}
|
|
60
|
+
color={color}
|
|
61
|
+
margin={margin}
|
|
62
|
+
textAlign={textAlign}
|
|
63
|
+
extraStyles={extraStyles}
|
|
64
|
+
className={className}
|
|
65
|
+
fontFamily={themeValues.fontFamily}
|
|
66
|
+
fontSize={themeValues.fontSize}
|
|
67
|
+
data-qa={dataQa}
|
|
68
|
+
{...rest}
|
|
69
|
+
>
|
|
70
|
+
{safeChildren(children, <span />)}
|
|
71
|
+
</TitleText>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default themeComponent(Title, "Title", fallbacks, "large");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const TitleText = styled.h1`
|
|
4
|
+
font-size: ${({ fontSize }) => fontSize};
|
|
5
|
+
line-height: 1.5;
|
|
6
|
+
color: ${({ color }) => color};
|
|
7
|
+
font-weight: ${({ weight }) => weight};
|
|
8
|
+
margin: ${({ margin }) => margin};
|
|
9
|
+
text-align: ${({ textAlign }) => textAlign};
|
|
10
|
+
font-family: ${({ fontFamily }) => fontFamily};
|
|
11
|
+
|
|
12
|
+
${({ extraStyles }) => extraStyles};
|
|
13
|
+
`;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const fontSize = {
|
|
2
|
+
large: "1.5rem",
|
|
3
|
+
small: "1.25rem"
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const fontFamily = {
|
|
7
|
+
large: "Public Sans",
|
|
8
|
+
small: "Public Sans"
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const mobileFontSize = {
|
|
12
|
+
large: "1.5rem",
|
|
13
|
+
small: "1.2142rem"
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const fallbackValues = {
|
|
17
|
+
fontFamily,
|
|
18
|
+
fontSize
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const mobileFallbackValues = {
|
|
22
|
+
fontFamily,
|
|
23
|
+
fontSize: mobileFontSize
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const MOBILE_BREAKPOINT = 768;
|
|
@@ -16,9 +16,7 @@ const Module = ({
|
|
|
16
16
|
<Fragment>
|
|
17
17
|
{heading && (
|
|
18
18
|
<Heading
|
|
19
|
-
variant={
|
|
20
|
-
variant === "small" ? "h6" : variant === "default" ? "h5" : "h2"
|
|
21
|
-
}
|
|
19
|
+
variant={variant === "default" ? "h5" : "h2"}
|
|
22
20
|
weight={themeValues.fontWeight}
|
|
23
21
|
color={themeValues.fontColor}
|
|
24
22
|
margin={`${spacing} 0 ${themeValues.titleSpacing} 0`}
|
|
@@ -1,38 +1,20 @@
|
|
|
1
1
|
import { WHITE, CHARADE_GREY } from "../../../constants/colors";
|
|
2
2
|
|
|
3
|
-
const fontSize = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
default: CHARADE_GREY,
|
|
11
|
-
largeTitle: CHARADE_GREY,
|
|
12
|
-
small: CHARADE_GREY
|
|
13
|
-
};
|
|
14
|
-
const lineHeight = { default: "2rem", largeTitle: "2rem", small: "2rem" };
|
|
15
|
-
const textAlign = { default: "left", largeTitle: "left", small: "left" };
|
|
16
|
-
const titleType = { default: "h5", largeTitle: "h1", small: "h6" };
|
|
17
|
-
const titleSpacing = {
|
|
18
|
-
default: "0.5rem",
|
|
19
|
-
largeTitle: "1.125rem",
|
|
20
|
-
small: "0.5rem"
|
|
21
|
-
};
|
|
3
|
+
const fontSize = { default: "1.375rem", largeTitle: "1.75rem" };
|
|
4
|
+
const fontWeight = { default: "600", largeTitle: "700" };
|
|
5
|
+
const fontColor = { default: CHARADE_GREY, largeTitle: CHARADE_GREY };
|
|
6
|
+
const lineHeight = { default: "2rem", largeTitle: "2rem" };
|
|
7
|
+
const textAlign = { default: "left", largeTitle: "left" };
|
|
8
|
+
const titleType = { default: "h5", largeTitle: "h1" };
|
|
9
|
+
const titleSpacing = { default: "0.5rem", largeTitle: "1.125rem" };
|
|
22
10
|
const boxShadow = {
|
|
23
11
|
default:
|
|
24
12
|
"0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
25
13
|
largeTitle:
|
|
26
|
-
"0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
27
|
-
small:
|
|
28
14
|
"0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
|
|
29
15
|
};
|
|
30
|
-
const borderRadius = {
|
|
31
|
-
|
|
32
|
-
largeTitle: "0.25rem",
|
|
33
|
-
small: "0.25rem"
|
|
34
|
-
};
|
|
35
|
-
const backgroundColor = { default: WHITE, largeTitle: WHITE, small: WHITE };
|
|
16
|
+
const borderRadius = { default: "0.25rem", largeTitle: "0.25rem" };
|
|
17
|
+
const backgroundColor = { default: WHITE, largeTitle: WHITE };
|
|
36
18
|
|
|
37
19
|
export const fallbackValues = {
|
|
38
20
|
fontSize,
|
|
@@ -10,14 +10,12 @@ import LabeledAmount from "../../atoms/labeled-amount";
|
|
|
10
10
|
import LineItem from "../../atoms/line-item";
|
|
11
11
|
import Heading from "../../atoms/heading";
|
|
12
12
|
import SolidDivider from "../../atoms/solid-divider";
|
|
13
|
-
import { FONT_WEIGHT_BOLD } from "../../../constants/style_constants";
|
|
14
13
|
|
|
15
14
|
const PaymentDetailsContent = ({
|
|
16
15
|
lineItemElems,
|
|
17
16
|
feeElems,
|
|
18
17
|
subtotal,
|
|
19
18
|
total,
|
|
20
|
-
variant,
|
|
21
19
|
themeValues
|
|
22
20
|
}) => (
|
|
23
21
|
<Stack childGap="16px">
|
|
@@ -37,7 +35,6 @@ const PaymentDetailsContent = ({
|
|
|
37
35
|
variant={themeValues.labeledAmountTotal}
|
|
38
36
|
label="Total"
|
|
39
37
|
amount={displayCurrency(total)}
|
|
40
|
-
extraStyles={variant === "small" && `font-weight: ${FONT_WEIGHT_BOLD};`}
|
|
41
38
|
/>
|
|
42
39
|
</Stack>
|
|
43
40
|
);
|
|
@@ -77,7 +74,6 @@ const PaymentDetails = ({
|
|
|
77
74
|
fees: _fees,
|
|
78
75
|
subtotal,
|
|
79
76
|
total,
|
|
80
|
-
variant = "default",
|
|
81
77
|
hideTitle = false,
|
|
82
78
|
titleText = "Payment Details",
|
|
83
79
|
initiallyOpen = false,
|
|
@@ -117,12 +113,12 @@ const PaymentDetails = ({
|
|
|
117
113
|
<SolidDivider />
|
|
118
114
|
<Box padding="8px" />
|
|
119
115
|
<PaymentDetailsContent
|
|
120
|
-
{...{ lineItemElems, feeElems, subtotal, total, themeValues
|
|
116
|
+
{...{ lineItemElems, feeElems, subtotal, total, themeValues }}
|
|
121
117
|
/>
|
|
122
118
|
</Stack>
|
|
123
119
|
) : (
|
|
124
120
|
<PaymentDetailsContent
|
|
125
|
-
{...{ lineItemElems, feeElems, subtotal, total, themeValues
|
|
121
|
+
{...{ lineItemElems, feeElems, subtotal, total, themeValues }}
|
|
126
122
|
/>
|
|
127
123
|
);
|
|
128
124
|
const title = hideTitle ? (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const backgroundColor = { default: "transparent", small: "transparent" };
|
|
2
2
|
const lineItem = { default: "default", small: "small" };
|
|
3
|
-
const labeledAmountSubtotal = { default: "pL", small: "
|
|
4
|
-
const labeledAmountTotal = { default: "h6", small: "
|
|
3
|
+
const labeledAmountSubtotal = { default: "pL", small: "p" };
|
|
4
|
+
const labeledAmountTotal = { default: "h6", small: "pL" };
|
|
5
5
|
|
|
6
6
|
export const fallbackValues = {
|
|
7
7
|
backgroundColor,
|