Skip to content

Commit b7f575b

Browse files
committed
Updated code to account for edge cases with APM buttons, Apple Pay, and the menu button. New functions created in styleUtils to calculate the css properties for these cases according to break points
1 parent f0ca07c commit b7f575b

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

Diff for: src/ui/buttons/styles/responsive.js

+55
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,14 @@ const generateDisableMaxHeightStyles = ({
365365
.map((disableMaxHeightSize) => {
366366
const {
367367
disableHeightStyle,
368+
buttonHeight,
368369
labelHeight,
369370
fontSize,
370371
marginTop,
371372
spinnerSize,
373+
pillBorderRadius,
374+
APMHeight,
375+
applePayHeight,
372376
} = getDisableMaxHeightResponsiveStyleVariables({
373377
fundingEligibility,
374378
experiment,
@@ -398,6 +402,57 @@ const generateDisableMaxHeightStyles = ({
398402
margin: 0 4vw;
399403
height: ${labelHeight}px;
400404
}
405+
406+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.APPLEPAY}]
407+
.${CLASS.BUTTON_LABEL} {
408+
height: ${applePayHeight}px;
409+
}
410+
411+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.APPLEPAY}]
412+
.${CLASS.BUTTON_LABEL} .${CLASS.TEXT} {
413+
line-height: ${applePayHeight}px;
414+
}
415+
416+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.EPS}]
417+
.${CLASS.BUTTON_LABEL},
418+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.MYBANK}]
419+
.${CLASS.BUTTON_LABEL} {
420+
height: ${APMHeight}px;
421+
}
422+
423+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.EPS}]
424+
.${CLASS.BUTTON_LABEL} .${CLASS.TEXT},
425+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.EPS}]
426+
.${CLASS.BUTTON_LABEL} .${CLASS.SPACE},
427+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.MYBANK}]
428+
.${CLASS.BUTTON_LABEL} .${CLASS.TEXT},
429+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.MYBANK}]
430+
.${CLASS.BUTTON_LABEL} .${CLASS.SPACE} {
431+
line-height: ${APMHeight}px;
432+
}
433+
434+
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} {
435+
border-radius: ${pillBorderRadius}px;
436+
}
437+
438+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL}
439+
.menu-button {
440+
border-top-right-radius: ${pillBorderRadius}px;
441+
border-bottom-right-radius: ${pillBorderRadius}px;
442+
}
443+
444+
.${CLASS.BUTTON_ROW}.${CLASS.WALLET}.${CLASS.WALLET_MENU}
445+
.${CLASS.BUTTON} {
446+
width: calc(100% - ${buttonHeight + 2}px);
447+
border-top-right-radius: 0px;
448+
border-bottom-right-radius: 0px;
449+
}
450+
451+
.menu-button {
452+
height: 100%;
453+
width: auto;
454+
aspect-ratio: 1;
455+
}
401456
}
402457
`;
403458
})

Diff for: src/ui/buttons/styles/styleUtils.js

+24
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ function getSpinnerSize({ height }: {| height: number |}): number {
6666
return parseInt(spinner, 10);
6767
}
6868

69+
function getAPMButtonHeight({ height }: {| height: number |}): number {
70+
const buttonHeight = perc(height, 50) + 5;
71+
72+
return parseInt(buttonHeight, 10);
73+
}
74+
75+
function getApplePayButtonHeight({ height }: {| height: number |}): number {
76+
const buttonHeight = perc(height, 80) + 5;
77+
78+
return parseInt(buttonHeight, 10);
79+
}
80+
6981
export function getResponsiveStyleVariables({
7082
height,
7183
fundingEligibility,
@@ -169,13 +181,25 @@ export function getDisableMaxHeightResponsiveStyleVariables({
169181
const spinnerSize = getSpinnerSize({
170182
height: buttonHeight,
171183
});
184+
const APMHeight = getAPMButtonHeight({
185+
height: buttonHeight,
186+
});
187+
const applePayHeight = getApplePayButtonHeight({
188+
height: buttonHeight,
189+
});
190+
191+
const pillBorderRadius = Math.ceil(buttonHeight / 2);
172192

173193
const styleVariables = {
174194
disableHeightStyle,
195+
buttonHeight,
175196
labelHeight,
176197
fontSize,
177198
marginTop,
178199
spinnerSize,
200+
pillBorderRadius,
201+
APMHeight,
202+
applePayHeight,
179203
};
180204

181205
return styleVariables;

0 commit comments

Comments
 (0)