@paypal/checkout-components 5.0.412 → 5.0.414
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/button.js +1 -1
- package/dist/test/button.js +1 -1
- package/package.json +2 -2
- package/src/constants/button.js +6 -0
- package/src/funding/common.jsx +6 -0
- package/src/funding/funding.js +8 -1
- package/src/funding/funding.test.js +69 -0
- package/src/funding/itau/config.jsx +21 -8
- package/src/funding/paylater/config.jsx +7 -12
- package/src/funding/paypal/monogramMark.jsx +10 -0
- package/src/funding/paypal/monogramMark.test.jsx +24 -0
- package/src/funding/sepa/config.jsx +29 -1
- package/src/marks/component.jsx +8 -1
- package/src/marks/templateRebrand.jsx +32 -2
- package/src/marks/templateRebrand.test.jsx +101 -0
- package/src/ui/buttons/buttons.jsx +2 -0
- package/src/ui/buttons/config.js +50 -26
- package/src/ui/buttons/poweredBy.jsx +8 -3
- package/src/ui/buttons/props.js +7 -29
- package/src/ui/buttons/props.test.js +0 -42
- package/src/ui/buttons/script.jsx +0 -47
- package/src/ui/buttons/styles/button.js +21 -4
- package/src/ui/buttons/styles/color.js +67 -41
- package/src/ui/buttons/styles/disableMaxHeightConfig.test.js +71 -0
- package/src/ui/buttons/styles/labels.js +23 -0
- package/src/ui/buttons/styles/responsive.js +124 -88
- package/src/ui/buttons/styles/styleUtils.js +9 -7
- package/src/ui/buttons/styles/styleUtils.test.js +23 -76
- package/src/ui/buttons/tagline.jsx +8 -4
- package/src/zoid/buttons/component.jsx +4 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* @flow */
|
|
2
|
+
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
BUTTON_REDESIGN_STYLE,
|
|
7
|
+
BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE,
|
|
8
|
+
} from "../config";
|
|
9
|
+
|
|
10
|
+
describe("BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE config", () => {
|
|
11
|
+
test("should include all BUTTON_REDESIGN_STYLE buckets", () => {
|
|
12
|
+
Object.keys(BUTTON_REDESIGN_STYLE).forEach((key) => {
|
|
13
|
+
expect(BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE).toHaveProperty(key);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test("should have XL_BIG bucket with correct values", () => {
|
|
18
|
+
expect(BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE.XL_BIG).toEqual({
|
|
19
|
+
minHeight: 60,
|
|
20
|
+
maxHeight: 65,
|
|
21
|
+
gap: 6,
|
|
22
|
+
fontSize: 20,
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test("should have XXL_SMALL bucket with correct values", () => {
|
|
27
|
+
expect(BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE.XXL_SMALL).toEqual({
|
|
28
|
+
minHeight: 65,
|
|
29
|
+
maxHeight: 70,
|
|
30
|
+
gap: 7,
|
|
31
|
+
fontSize: 22,
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test("should have XXL_BIG bucket with correct values", () => {
|
|
36
|
+
expect(BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE.XXL_BIG).toEqual({
|
|
37
|
+
minHeight: 70,
|
|
38
|
+
maxHeight: 75,
|
|
39
|
+
gap: 7,
|
|
40
|
+
fontSize: 24,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
test("should have XXXL bucket with correct values", () => {
|
|
45
|
+
expect(BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE.XXXL).toEqual({
|
|
46
|
+
minHeight: 75,
|
|
47
|
+
maxHeight: 200,
|
|
48
|
+
gap: 8,
|
|
49
|
+
fontSize: 26,
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("should have no gaps in height coverage between buckets", () => {
|
|
54
|
+
const buckets = Object.keys(BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE)
|
|
55
|
+
.map((key) => BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE[key])
|
|
56
|
+
.filter((b) => b.minHeight !== undefined && b.maxHeight !== undefined)
|
|
57
|
+
.sort((a, b) => a.minHeight - b.minHeight);
|
|
58
|
+
|
|
59
|
+
for (let i = 1; i < buckets.length; i++) {
|
|
60
|
+
expect(buckets[i].minHeight).toBeLessThanOrEqual(
|
|
61
|
+
buckets[i - 1].maxHeight
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test("should have continuous height coverage up to 200", () => {
|
|
67
|
+
const keys = Object.keys(BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE);
|
|
68
|
+
const lastKey = keys[keys.length - 1];
|
|
69
|
+
expect(BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE[lastKey].maxHeight).toBe(200);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -72,9 +72,32 @@ export const labelStyle = `
|
|
|
72
72
|
CLASS.BUTTON_LABEL
|
|
73
73
|
} {
|
|
74
74
|
font-family: PayPal Pro Book, system-ui, -apple-system, Roboto, "Segoe UI", Helvetica-Neue, Helvetica, Arial, sans-serif;
|
|
75
|
+
font-weight: 500;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
.${CLASS.BUTTON_REBRAND}[data-funding-source=venmo] .${CLASS.BUTTON_LABEL} {
|
|
78
79
|
font-family: Scto Grotesk A, system-ui, -apple-system, Roboto, "Segoe UI", Helvetica-Neue, Helvetica, Arial, sans-serif;
|
|
79
80
|
}
|
|
81
|
+
|
|
82
|
+
/* targeting only credit and paylater buttons for the logo swap */
|
|
83
|
+
.${CLASS.BUTTON_REBRAND}[data-funding-source=credit],
|
|
84
|
+
.${CLASS.BUTTON_REBRAND}[data-funding-source=paylater] {
|
|
85
|
+
container-type: size;
|
|
86
|
+
container-name: paylater-credit-btn;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.${CLASS.BUTTON_REBRAND} .${CLASS.LOGO_PP_REBRAND} {
|
|
90
|
+
display: none;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* At smaller sizes, swap out the full paypal watermark for the smaller pp monogram. At 150px-200px wide: 25-40px show wordmark, 45px triggers monogram. */
|
|
94
|
+
@container paylater-credit-btn ((max-width: 197px) and (min-height: 43px)) or ((max-width: 147px) and (max-height: 43px)) or ((max-width: 250px) and (min-height: 60px)) {
|
|
95
|
+
.${CLASS.BUTTON_LABEL} > .${CLASS.LOGO_REBRAND} {
|
|
96
|
+
display: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.${CLASS.BUTTON_LABEL} > .${CLASS.LOGO_PP_REBRAND} {
|
|
100
|
+
display: inline-block;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
80
103
|
`;
|
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
BUTTON_RELATIVE_STYLE,
|
|
19
19
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE,
|
|
20
20
|
BUTTON_REDESIGN_STYLE,
|
|
21
|
+
BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE,
|
|
22
|
+
REBRAND_LABEL_HEIGHT_RATIO,
|
|
21
23
|
} from "../config";
|
|
22
24
|
import { isBorderRadiusNumber } from "../util";
|
|
23
25
|
|
|
@@ -179,20 +181,23 @@ const generateButtonSizeStyles = ({
|
|
|
179
181
|
.${CLASS.BUTTON}.${CLASS.BORDER_RADIUS} {
|
|
180
182
|
${
|
|
181
183
|
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
182
|
-
?
|
|
184
|
+
? `--btn-radius: ${borderRadius}px; border-radius: ${borderRadius}px`
|
|
183
185
|
: ""
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
|
|
187
189
|
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.SHARP} {
|
|
190
|
+
--btn-radius: 0px;
|
|
188
191
|
border-radius: 0px;
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.RECT} {
|
|
195
|
+
--btn-radius: 4px;
|
|
192
196
|
border-radius: 4px;
|
|
193
197
|
}
|
|
194
198
|
|
|
195
199
|
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} {
|
|
200
|
+
--btn-radius: ${pillBorderRadius}px;
|
|
196
201
|
border-radius: ${pillBorderRadius}px;
|
|
197
202
|
}
|
|
198
203
|
|
|
@@ -399,7 +404,7 @@ const generateDisableMaxHeightStyles = ({
|
|
|
399
404
|
const { minHeight, maxHeight } = disableHeightStyle;
|
|
400
405
|
|
|
401
406
|
return `
|
|
402
|
-
@
|
|
407
|
+
@container (min-height: ${minHeight}px) and (max-height: ${maxHeight}px) {
|
|
403
408
|
.${CLASS.BUTTON_LABEL} {
|
|
404
409
|
gap: ${gap}px;
|
|
405
410
|
}
|
|
@@ -457,7 +462,7 @@ const generateDisableMaxHeightStyles = ({
|
|
|
457
462
|
border-radius: ${pillBorderRadius}px;
|
|
458
463
|
}
|
|
459
464
|
|
|
460
|
-
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL}
|
|
465
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL}
|
|
461
466
|
.menu-button {
|
|
462
467
|
border-top-right-radius: ${pillBorderRadius}px;
|
|
463
468
|
border-bottom-right-radius: ${pillBorderRadius}px;
|
|
@@ -482,21 +487,26 @@ const generateDisableMaxHeightStyles = ({
|
|
|
482
487
|
};
|
|
483
488
|
|
|
484
489
|
const generateRebrandedDisableMaxHeightStyles = (): string => {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
490
|
+
const sizeKeys = Object.keys(BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE);
|
|
491
|
+
return sizeKeys
|
|
492
|
+
.map((redesignSize, sizeIndex) => {
|
|
493
|
+
const isLastSizeBucket = sizeIndex === sizeKeys.length - 1;
|
|
494
|
+
const style = BUTTON_REDESIGN_DISABLEMAXHEIGHT_STYLE[redesignSize];
|
|
495
|
+
const { gap, fontSize, minHeight, maxHeight } = style;
|
|
496
|
+
const maxHeightQuery = isLastSizeBucket
|
|
497
|
+
? ""
|
|
498
|
+
: `and (max-height: ${maxHeight}px)`;
|
|
491
499
|
|
|
492
500
|
return `
|
|
493
|
-
@
|
|
501
|
+
@container (min-height: ${minHeight}px) ${maxHeightQuery} {
|
|
494
502
|
.${CLASS.BUTTON_REBRAND} > .${CLASS.BUTTON_LABEL} {
|
|
495
503
|
gap: ${gap}px;
|
|
496
504
|
}
|
|
497
|
-
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.TEXT},
|
|
498
|
-
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.SPACE} {
|
|
505
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND} .${CLASS.TEXT},
|
|
506
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND} .${CLASS.SPACE} {
|
|
499
507
|
font-size: ${fontSize}px;
|
|
508
|
+
line-height: 1.2;
|
|
509
|
+
margin: 0;
|
|
500
510
|
}
|
|
501
511
|
}
|
|
502
512
|
`;
|
|
@@ -517,11 +527,12 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
517
527
|
borderRadius?: ?number,
|
|
518
528
|
shouldApplyRebrandedStyles?: boolean,
|
|
519
529
|
|}): string => {
|
|
520
|
-
|
|
521
|
-
|
|
530
|
+
const redesignSizeKeys = Object.keys(BUTTON_REDESIGN_STYLE);
|
|
531
|
+
return redesignSizeKeys
|
|
532
|
+
.map((redesignSize, sizeIndex) => {
|
|
533
|
+
const isLastSizeBucket = sizeIndex === redesignSizeKeys.length - 1;
|
|
522
534
|
const {
|
|
523
535
|
buttonHeight,
|
|
524
|
-
pillBorderRadius,
|
|
525
536
|
gap,
|
|
526
537
|
fontSize,
|
|
527
538
|
defaultHeight,
|
|
@@ -532,9 +543,13 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
532
543
|
minDualWidth,
|
|
533
544
|
} = getResponsiveRebrandedStyleVariables({
|
|
534
545
|
height,
|
|
535
|
-
|
|
546
|
+
redesignSize,
|
|
536
547
|
});
|
|
537
548
|
|
|
549
|
+
const maxWidthQuery = isLastSizeBucket
|
|
550
|
+
? ""
|
|
551
|
+
: `and (max-width: ${maxWidth}px)`;
|
|
552
|
+
|
|
538
553
|
const widthBasedStyles = `
|
|
539
554
|
@media only screen and (min-width: ${minWidth}px) {
|
|
540
555
|
.${CLASS.CONTAINER} {
|
|
@@ -556,7 +571,9 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
556
571
|
.${CLASS.BUTTON_REBRAND} > .${CLASS.BUTTON_LABEL} {
|
|
557
572
|
margin: 0px 4vw;
|
|
558
573
|
box-sizing: border-box;
|
|
559
|
-
height: ${
|
|
574
|
+
height: ${Math.round(
|
|
575
|
+
buttonHeight * REBRAND_LABEL_HEIGHT_RATIO
|
|
576
|
+
)}px;
|
|
560
577
|
}
|
|
561
578
|
|
|
562
579
|
.${CLASS.BUTTON_REBRAND}.${CLASS.NUMBER}-${BUTTON_NUMBER.MULTIPLE} .${
|
|
@@ -565,20 +582,8 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
565
582
|
gap: ${gap}px;
|
|
566
583
|
}
|
|
567
584
|
|
|
568
|
-
.${CLASS.
|
|
569
|
-
|
|
570
|
-
} .${CLASS.TEXT},
|
|
571
|
-
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW}.${CLASS.NUMBER}-${
|
|
572
|
-
BUTTON_NUMBER.MULTIPLE
|
|
573
|
-
} .${CLASS.SPACE} {
|
|
574
|
-
font-size: ${fontSize}px;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
.${CLASS.BUTTON_ROW}.${CLASS.NUMBER}-${BUTTON_NUMBER.MULTIPLE} .${
|
|
578
|
-
CLASS.BUTTON_REBRAND
|
|
579
|
-
} .${CLASS.TEXT} {
|
|
580
|
-
line-height: 1.2;
|
|
581
|
-
margin: 0;
|
|
585
|
+
.${CLASS.TAGLINE} .${CLASS.TEXT} {
|
|
586
|
+
font-size: ${minWidth >= 500 ? 14 : 12}px;
|
|
582
587
|
}
|
|
583
588
|
|
|
584
589
|
.${CLASS.BUTTON_ROW}.${CLASS.LAYOUT}-${BUTTON_LAYOUT.VERTICAL}.${
|
|
@@ -596,8 +601,73 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
596
601
|
}-${BUTTON_NUMBER.MULTIPLE}:last-child {
|
|
597
602
|
margin-bottom: 0;
|
|
598
603
|
}
|
|
604
|
+
|
|
605
|
+
.${CLASS.BUTTON}.${CLASS.BORDER_RADIUS} {
|
|
606
|
+
${
|
|
607
|
+
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
608
|
+
? `--btn-radius: ${borderRadius}px; border-radius: ${borderRadius}px`
|
|
609
|
+
: ""
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.SHARP} {
|
|
614
|
+
--btn-radius: 0px;
|
|
615
|
+
border-radius: 0px;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.RECT} {
|
|
619
|
+
--btn-radius: 4px;
|
|
620
|
+
border-radius: 4px;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} {
|
|
624
|
+
--btn-radius: 9999px;
|
|
625
|
+
border-radius: 9999px;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.${CLASS.BUTTON_ROW}.${CLASS.BORDER_RADIUS} .menu-button {
|
|
629
|
+
${
|
|
630
|
+
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
631
|
+
? `border-top-right-radius: ${borderRadius}px; border-bottom-right-radius: ${borderRadius}px`
|
|
632
|
+
: ""
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
637
|
+
BUTTON_SHAPE.SHARP
|
|
638
|
+
} .menu-button {
|
|
639
|
+
border-top-right-radius: 0px;
|
|
640
|
+
border-bottom-right-radius: 0px;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
644
|
+
BUTTON_SHAPE.RECT
|
|
645
|
+
} .menu-button {
|
|
646
|
+
border-top-right-radius: 4px;
|
|
647
|
+
border-bottom-right-radius: 4px;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
651
|
+
BUTTON_SHAPE.PILL
|
|
652
|
+
} .menu-button {
|
|
653
|
+
border-top-right-radius: 9999px;
|
|
654
|
+
border-bottom-right-radius: 9999px;
|
|
655
|
+
}
|
|
599
656
|
}
|
|
600
|
-
|
|
657
|
+
|
|
658
|
+
@media only screen and (min-width: ${minWidth}px) ${maxWidthQuery} {
|
|
659
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND} .${
|
|
660
|
+
CLASS.TEXT
|
|
661
|
+
},
|
|
662
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND} .${
|
|
663
|
+
CLASS.SPACE
|
|
664
|
+
} {
|
|
665
|
+
font-size: ${fontSize}px;
|
|
666
|
+
line-height: 1.2;
|
|
667
|
+
margin: 0;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
601
671
|
@media only screen and (min-width: ${minWidth}px) and (max-width: ${minDualWidth}px) {
|
|
602
672
|
.${CLASS.BUTTON_ROW}.${CLASS.LAYOUT}-${BUTTON_LAYOUT.HORIZONTAL}.${
|
|
603
673
|
CLASS.NUMBER
|
|
@@ -672,17 +742,18 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
672
742
|
`;
|
|
673
743
|
|
|
674
744
|
const heightBasedStyles = `
|
|
675
|
-
@
|
|
745
|
+
@container (min-height: ${minHeight}px) and (max-height: ${maxHeight}px) {
|
|
676
746
|
.${CLASS.BUTTON_REBRAND} > .${CLASS.BUTTON_LABEL} {
|
|
677
747
|
gap: ${gap}px;
|
|
678
748
|
}
|
|
679
749
|
|
|
680
|
-
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.
|
|
681
|
-
|
|
750
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND}.${
|
|
751
|
+
CLASS.BUTTON_REBRAND
|
|
752
|
+
} .${CLASS.TEXT},
|
|
753
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND}.${
|
|
754
|
+
CLASS.BUTTON_REBRAND
|
|
755
|
+
} .${CLASS.SPACE} {
|
|
682
756
|
font-size: ${fontSize}px;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
.${CLASS.BUTTON_ROW} .${CLASS.BUTTON_REBRAND} .${CLASS.TEXT} {
|
|
686
757
|
line-height: 1.2;
|
|
687
758
|
margin: 0;
|
|
688
759
|
}
|
|
@@ -733,56 +804,7 @@ const generateRebrandedButtonSizeStyles = ({
|
|
|
733
804
|
} .${CLASS.SPACE} {
|
|
734
805
|
line-height: ${perc(buttonHeight, 50) + 5}px;
|
|
735
806
|
}
|
|
736
|
-
|
|
737
|
-
.${CLASS.BUTTON}.${CLASS.BORDER_RADIUS} {
|
|
738
|
-
${
|
|
739
|
-
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
740
|
-
? `border-radius: ${borderRadius}px`
|
|
741
|
-
: ""
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.SHARP} {
|
|
746
|
-
border-radius: 0px;
|
|
747
|
-
}
|
|
748
807
|
|
|
749
|
-
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.RECT} {
|
|
750
|
-
border-radius: 4px;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} {
|
|
754
|
-
border-radius: ${pillBorderRadius}px;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
.${CLASS.BUTTON_ROW}.${CLASS.BORDER_RADIUS} .menu-button {
|
|
758
|
-
${
|
|
759
|
-
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
760
|
-
? `border-top-right-radius: ${borderRadius}px; border-bottom-right-radius: ${borderRadius}px`
|
|
761
|
-
: ""
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
766
|
-
BUTTON_SHAPE.SHARP
|
|
767
|
-
} .menu-button {
|
|
768
|
-
border-top-right-radius: 0px;
|
|
769
|
-
border-bottom-right-radius: 0px;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
773
|
-
BUTTON_SHAPE.RECT
|
|
774
|
-
} .menu-button {
|
|
775
|
-
border-top-right-radius: 4px;
|
|
776
|
-
border-bottom-right-radius: 4px;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
780
|
-
BUTTON_SHAPE.PILL
|
|
781
|
-
} .menu-button {
|
|
782
|
-
border-top-right-radius: ${pillBorderRadius}px;
|
|
783
|
-
border-bottom-right-radius: ${pillBorderRadius}px;
|
|
784
|
-
}
|
|
785
|
-
|
|
786
808
|
.${CLASS.TAGLINE} .${CLASS.TEXT} {
|
|
787
809
|
height: ${perc(buttonHeight, BUTTON_RELATIVE_STYLE.TAGLINE)}px;
|
|
788
810
|
line-height: ${perc(
|
|
@@ -869,16 +891,22 @@ export function buttonResponsiveStyle({
|
|
|
869
891
|
.${CLASS.BUTTON}.${CLASS.BORDER_RADIUS} {
|
|
870
892
|
${
|
|
871
893
|
borderRadius && isBorderRadiusNumber(borderRadius)
|
|
872
|
-
?
|
|
894
|
+
? `--btn-radius: ${borderRadius}px; border-radius: ${borderRadius}px`
|
|
873
895
|
: ""
|
|
874
896
|
};
|
|
875
897
|
}
|
|
876
898
|
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.SHARP} {
|
|
899
|
+
--btn-radius: 0px;
|
|
877
900
|
border-radius: 0px;
|
|
878
901
|
}
|
|
879
902
|
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.RECT} {
|
|
903
|
+
--btn-radius: 4px;
|
|
880
904
|
border-radius: 4px;
|
|
881
905
|
}
|
|
906
|
+
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} {
|
|
907
|
+
--btn-radius: 9999px;
|
|
908
|
+
border-radius: 9999px;
|
|
909
|
+
}
|
|
882
910
|
|
|
883
911
|
// menu button - border radius
|
|
884
912
|
.${CLASS.BUTTON_ROW}.${CLASS.BORDER_RADIUS} .menu-button {
|
|
@@ -898,10 +926,18 @@ export function buttonResponsiveStyle({
|
|
|
898
926
|
border-top-right-radius: 4px;
|
|
899
927
|
border-bottom-right-radius: 4px;
|
|
900
928
|
}
|
|
929
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} .menu-button {
|
|
930
|
+
border-top-right-radius: 9999px;
|
|
931
|
+
border-bottom-right-radius: 9999px;
|
|
932
|
+
}
|
|
901
933
|
|
|
902
934
|
.${CLASS.CARD} {
|
|
903
935
|
display: inline-block;
|
|
904
936
|
height: 100%;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
.${CLASS.BUTTON_ROW} {
|
|
940
|
+
container-type: size;
|
|
905
941
|
}`;
|
|
906
942
|
|
|
907
943
|
const rebrandedStyles = shouldApplyRebrandedStyles
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE,
|
|
8
8
|
BUTTON_SIZE_STYLE,
|
|
9
9
|
BUTTON_REDESIGN_STYLE,
|
|
10
|
+
REBRAND_LABEL_HEIGHT_RATIO,
|
|
10
11
|
} from "../config";
|
|
11
12
|
import {
|
|
12
13
|
BUTTON_SIZE,
|
|
@@ -32,7 +33,7 @@ function getLabelHeight({
|
|
|
32
33
|
let labelHeight = max(roundUp(perc(height, labelPercPercentage) + 5, 2), 12);
|
|
33
34
|
|
|
34
35
|
if (shouldApplyRebrandedStyles) {
|
|
35
|
-
labelHeight = roundUp(perc(height,
|
|
36
|
+
labelHeight = roundUp(perc(height, REBRAND_LABEL_HEIGHT_RATIO * 100), 1);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
return parseInt(labelHeight, 10);
|
|
@@ -141,7 +142,10 @@ export function getResponsiveStyleVariables({
|
|
|
141
142
|
const pillBorderRadius = Math.ceil(buttonHeight / 2);
|
|
142
143
|
|
|
143
144
|
if (shouldApplyRebrandedStyles) {
|
|
144
|
-
labelHeight = roundUp(
|
|
145
|
+
labelHeight = roundUp(
|
|
146
|
+
perc(buttonHeight, REBRAND_LABEL_HEIGHT_RATIO * 100),
|
|
147
|
+
1
|
|
148
|
+
);
|
|
145
149
|
// smallerLabelHeight gets triggered at widths < 320px
|
|
146
150
|
// We will need to investigate why the labels need to get significantly smaller at this breakpoint
|
|
147
151
|
smallerLabelHeight = labelHeight;
|
|
@@ -165,12 +169,12 @@ export function getResponsiveStyleVariables({
|
|
|
165
169
|
|
|
166
170
|
export function getResponsiveRebrandedStyleVariables({
|
|
167
171
|
height,
|
|
168
|
-
|
|
172
|
+
redesignSize,
|
|
169
173
|
}: {|
|
|
170
174
|
height?: ?number,
|
|
171
|
-
|
|
175
|
+
redesignSize: $Values<typeof BUTTON_REDESIGN_SIZE>,
|
|
172
176
|
|}): Object {
|
|
173
|
-
const style = BUTTON_REDESIGN_STYLE[
|
|
177
|
+
const style = BUTTON_REDESIGN_STYLE[redesignSize];
|
|
174
178
|
const {
|
|
175
179
|
minHeight,
|
|
176
180
|
maxHeight,
|
|
@@ -182,7 +186,6 @@ export function getResponsiveRebrandedStyleVariables({
|
|
|
182
186
|
} = style;
|
|
183
187
|
|
|
184
188
|
const buttonHeight = height || defaultHeight;
|
|
185
|
-
const pillBorderRadius = Math.ceil(buttonHeight / 2);
|
|
186
189
|
|
|
187
190
|
const minDualWidth = Math.max(
|
|
188
191
|
Math.round(
|
|
@@ -194,7 +197,6 @@ export function getResponsiveRebrandedStyleVariables({
|
|
|
194
197
|
const styleVariables = {
|
|
195
198
|
style,
|
|
196
199
|
buttonHeight,
|
|
197
|
-
pillBorderRadius,
|
|
198
200
|
gap,
|
|
199
201
|
defaultHeight,
|
|
200
202
|
minHeight,
|