@skyscanner/backpack-web 35.4.0 → 35.5.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.
|
@@ -21,6 +21,21 @@ import { SIZES, ALIGNS } from "./common-types";
|
|
|
21
21
|
import STYLES from "./BpkPrice.module.css";
|
|
22
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
23
|
const getClassName = cssModules(STYLES);
|
|
24
|
+
const getPriceTextStyle = size => {
|
|
25
|
+
if (size === SIZES.small) {
|
|
26
|
+
return TEXT_STYLES.heading4;
|
|
27
|
+
}
|
|
28
|
+
if (size === SIZES.large) {
|
|
29
|
+
return TEXT_STYLES.xxl;
|
|
30
|
+
}
|
|
31
|
+
return TEXT_STYLES.heading5;
|
|
32
|
+
};
|
|
33
|
+
const getDefaultTextStyle = size => {
|
|
34
|
+
if (size === SIZES.large) {
|
|
35
|
+
return TEXT_STYLES.sm;
|
|
36
|
+
}
|
|
37
|
+
return TEXT_STYLES.xs;
|
|
38
|
+
};
|
|
24
39
|
const BpkPrice = props => {
|
|
25
40
|
const {
|
|
26
41
|
align,
|
|
@@ -33,7 +48,8 @@ const BpkPrice = props => {
|
|
|
33
48
|
trailingText,
|
|
34
49
|
...rest
|
|
35
50
|
} = props;
|
|
36
|
-
const
|
|
51
|
+
const defaultTextStyle = getDefaultTextStyle(size);
|
|
52
|
+
const priceTextStyle = getPriceTextStyle(size);
|
|
37
53
|
const isAlignRight = align === ALIGNS.right;
|
|
38
54
|
return /*#__PURE__*/_jsxs("div", {
|
|
39
55
|
className: getClassName('bpk-price', isAlignRight && 'bpk-price--right', className)
|
|
@@ -45,19 +61,19 @@ const BpkPrice = props => {
|
|
|
45
61
|
children: [previousPrice && /*#__PURE__*/_jsx("span", {
|
|
46
62
|
className: getClassName('bpk-price__previous-price'),
|
|
47
63
|
children: /*#__PURE__*/_jsx(BpkText, {
|
|
48
|
-
textStyle:
|
|
64
|
+
textStyle: defaultTextStyle,
|
|
49
65
|
tagName: "span",
|
|
50
66
|
children: previousPrice
|
|
51
67
|
})
|
|
52
68
|
}), previousPrice && leadingText && /*#__PURE__*/_jsx("span", {
|
|
53
69
|
className: getClassName('bpk-price__separator'),
|
|
54
70
|
children: /*#__PURE__*/_jsx(BpkText, {
|
|
55
|
-
textStyle:
|
|
71
|
+
textStyle: defaultTextStyle,
|
|
56
72
|
tagName: "span",
|
|
57
73
|
children: "\uD802\uDD1F"
|
|
58
74
|
})
|
|
59
75
|
}), leadingText && /*#__PURE__*/_jsx(BpkText, {
|
|
60
|
-
textStyle:
|
|
76
|
+
textStyle: defaultTextStyle,
|
|
61
77
|
tagName: "span",
|
|
62
78
|
children: leadingText
|
|
63
79
|
})]
|
|
@@ -66,14 +82,14 @@ const BpkPrice = props => {
|
|
|
66
82
|
children: [/*#__PURE__*/_jsx("span", {
|
|
67
83
|
className: getClassName('bpk-price__price', !isAlignRight && 'bpk-price__spacing'),
|
|
68
84
|
children: /*#__PURE__*/_jsx(BpkText, {
|
|
69
|
-
textStyle:
|
|
85
|
+
textStyle: priceTextStyle,
|
|
70
86
|
tagName: "span",
|
|
71
87
|
children: price
|
|
72
88
|
})
|
|
73
89
|
}), trailingText && /*#__PURE__*/_jsx("span", {
|
|
74
90
|
className: getClassName('bpk-price__trailing'),
|
|
75
91
|
children: /*#__PURE__*/_jsx(BpkText, {
|
|
76
|
-
textStyle:
|
|
92
|
+
textStyle: defaultTextStyle,
|
|
77
93
|
tagName: "span",
|
|
78
94
|
children: trailingText
|
|
79
95
|
})
|